AI2 Component  (Version nb184)
DispatchableError.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright © 2017 Massachusetts Institute of Technology, All rights reserved.
3 // Released under the Apache License, Version 2.0
4 // http://www.apache.org/licenses/LICENSE-2.0
5 
6 package com.google.appinventor.components.runtime.errors;
7 
9 
10 import java.util.Arrays;
11 
12 public class DispatchableError extends RuntimeError {
13 
14  private final int errorCode;
15  @SuppressWarnings("squid:S1948")
16  private final Object[] arguments;
17 
18  public DispatchableError(int errorCode) {
19  super(ErrorMessages.formatMessage(errorCode, null));
20  this.errorCode = errorCode;
21  this.arguments = new Object[0];
22  }
23 
24  public DispatchableError(int errorCode, Object... arguments) {
25  super(ErrorMessages.formatMessage(errorCode, arguments));
26  this.errorCode = errorCode;
27  this.arguments = arguments;
28  }
29 
30  public int getErrorCode() {
31  return errorCode;
32  }
33 
34  public Object[] getArguments() {
35  return Arrays.copyOf(arguments, arguments.length);
36  }
37 }
com.google.appinventor.components.runtime.util.ErrorMessages.formatMessage
static String formatMessage(int errorNumber, Object[] messageArgs)
Definition: ErrorMessages.java:699
com.google.appinventor.components.runtime.errors.DispatchableError
Definition: DispatchableError.java:12
com.google.appinventor.components.runtime.util.ErrorMessages
Definition: ErrorMessages.java:17
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components
com.google.appinventor.components.runtime.errors.DispatchableError.getArguments
Object[] getArguments()
Definition: DispatchableError.java:34
com.google.appinventor.components.runtime.errors.DispatchableError.DispatchableError
DispatchableError(int errorCode)
Definition: DispatchableError.java:18
com.google.appinventor.components.runtime.errors.DispatchableError.DispatchableError
DispatchableError(int errorCode, Object... arguments)
Definition: DispatchableError.java:24
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google
com
com.google.appinventor.components.runtime.errors.RuntimeError
Definition: RuntimeError.java:16
com.google.appinventor
com.google.appinventor.components.runtime.errors.DispatchableError.getErrorCode
int getErrorCode()
Definition: DispatchableError.java:30