2017년 4월 15일 토요일

Creating Error Log


I'm trying to develope a method to create an Error Log, so I can store information about errors that happens in larger apps, in order to fix them faster.

This is the way I want to do it, but it stores anything at the existing ErrorLog folder. Not even the screenshot.
Button3 should cause the error to store.

Thanks in advance.

--
use Do it to check, if the name is a valid directory name
how do you test that functionality? do you have something, which triggers an error?

did the screenshot example work for you as it is without modifications?

--
Button3 (as it is in my image) should trigger an error (as it tries to select the second item of an empty list).

In the same app I have another button that takes an screenshot and saves it in the same directory, so the screenshot extension works and the directory should be a valid one.

I guess then that this doesn't launch the error ocurred event:
What is an error to AppInventor then?

--
see a complete list of errors, which will trigger the ErrorOccurred event below

  // Phone version errors
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_CONTACT_EMAIL = 1;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_EMAIL_PICKER = 2;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_FUSIONTABLES_CONTROL = 3;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_WEB_COOKIES = 4;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_WIFI_DIRECT = 5;
  // LocationSensor errors
  public static final int ERROR_LOCATION_SENSOR_LATITUDE_NOT_FOUND = 101;
  public static final int ERROR_LOCATION_SENSOR_LONGITUDE_NOT_FOUND = 102;
  // Camera errors
  public static final int ERROR_CAMERA_NO_IMAGE_RETURNED = 201;
  // Twitter errors
  public static final int ERROR_TWITTER_UNSUPPORTED_LOGIN_FUNCTION = 301;
  public static final int ERROR_TWITTER_BLANK_CONSUMER_KEY_OR_SECRET = 302;
  public static final int ERROR_TWITTER_EXCEPTION = 303;
  public static final int ERROR_TWITTER_UNABLE_TO_GET_ACCESS_TOKEN = 304;
  public static final int ERROR_TWITTER_AUTHORIZATION_FAILED = 305;
  public static final int ERROR_TWITTER_SET_STATUS_FAILED = 306;
  public static final int ERROR_TWITTER_REQUEST_MENTIONS_FAILED = 307;
  public static final int ERROR_TWITTER_REQUEST_FOLLOWERS_FAILED = 308;
  public static final int ERROR_TWITTER_REQUEST_DIRECT_MESSAGES_FAILED = 309;
  public static final int ERROR_TWITTER_DIRECT_MESSAGE_FAILED = 310;
  public static final int ERROR_TWITTER_FOLLOW_FAILED = 311;
  public static final int ERROR_TWITTER_STOP_FOLLOWING_FAILED = 312;
  public static final int ERROR_TWITTER_REQUEST_FRIEND_TIMELINE_FAILED = 313;
  public static final int ERROR_TWITTER_SEARCH_FAILED = 314;
  public static final int ERROR_TWITTER_INVALID_IMAGE_PATH = 315;
  // LegoMindstormsNXT errors
  public static final int ERROR_NXT_BLUETOOTH_NOT_SET = 401;
  public static final int ERROR_NXT_NOT_CONNECTED_TO_ROBOT = 402;
  public static final int ERROR_NXT_INVALID_RETURN_PACKAGE = 403;
  public static final int ERROR_NXT_ERROR_CODE_RECEIVED = 404;
  public static final int ERROR_NXT_INVALID_PROGRAM_NAME = 405;
  public static final int ERROR_NXT_INVALID_FILE_NAME = 406;
  public static final int ERROR_NXT_INVALID_MOTOR_PORT = 407;
  public static final int ERROR_NXT_INVALID_SENSOR_PORT = 408;
  public static final int ERROR_NXT_INVALID_MAILBOX = 409;
  public static final int ERROR_NXT_MESSAGE_TOO_LONG = 410;
  public static final int ERROR_NXT_DATA_TOO_LARGE = 411;
  public static final int ERROR_NXT_COULD_NOT_DECODE_ELEMENT = 412;
  public static final int ERROR_NXT_COULD_NOT_FIT_ELEMENT_IN_BYTE = 413;
  public static final int ERROR_NXT_INVALID_SOURCE_ARGUMENT = 414;
  public static final int ERROR_NXT_INVALID_DESTINATION_ARGUMENT = 415;
  public static final int ERROR_NXT_UNABLE_TO_DOWNLOAD_FILE = 416;
  public static final int ERROR_NXT_CANNOT_DETECT_COLOR = 417;
  public static final int ERROR_NXT_CANNOT_DETECT_LIGHT = 418;
  public static final int ERROR_NXT_INVALID_GENERATE_COLOR = 419;
  // Bluetooth errors
  public static final int ERROR_BLUETOOTH_NOT_AVAILABLE = 501;
  public static final int ERROR_BLUETOOTH_NOT_ENABLED = 502;
  public static final int ERROR_BLUETOOTH_INVALID_ADDRESS = 503;
  public static final int ERROR_BLUETOOTH_NOT_PAIRED_DEVICE = 504;
  public static final int ERROR_BLUETOOTH_NOT_REQUIRED_CLASS_OF_DEVICE = 505;
  public static final int ERROR_BLUETOOTH_INVALID_UUID = 506;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_CONNECT = 507;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_LISTEN = 508;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_ACCEPT = 509;
  public static final int ERROR_BLUETOOTH_COULD_NOT_DECODE = 510;
  public static final int ERROR_BLUETOOTH_COULD_NOT_FIT_NUMBER_IN_BYTE = 511;
  public static final int ERROR_BLUETOOTH_COULD_NOT_FIT_NUMBER_IN_BYTES = 512;
  public static final int ERROR_BLUETOOTH_COULD_NOT_DECODE_ELEMENT = 513;
  public static final int ERROR_BLUETOOTH_COULD_NOT_FIT_ELEMENT_IN_BYTE = 514;
  public static final int ERROR_BLUETOOTH_NOT_CONNECTED_TO_DEVICE = 515;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_WRITE = 516;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_READ = 517;
  public static final int ERROR_BLUETOOTH_END_OF_STREAM = 518;
  public static final int ERROR_BLUETOOTH_UNSUPPORTED_ENCODING = 519;
  // ActivityStarter errors
  public static final int ERROR_ACTIVITY_STARTER_NO_CORRESPONDING_ACTIVITY = 601;
  // Media errors
  public static final int ERROR_UNABLE_TO_LOAD_MEDIA = 701;
  public static final int ERROR_UNABLE_TO_PREPARE_MEDIA = 702;
  public static final int ERROR_UNABLE_TO_PLAY_MEDIA = 703;
  public static final int ERROR_MEDIA_EXTERNAL_STORAGE_READONLY = 704;
  public static final int ERROR_MEDIA_EXTERNAL_STORAGE_NOT_AVAILABLE = 705;
  public static final int ERROR_MEDIA_IMAGE_FILE_FORMAT = 706;
  public static final int ERROR_MEDIA_CANNOT_OPEN = 707;
  public static final int ERROR_MEDIA_FILE_ERROR = 708;
  public static final int ERROR_UNABLE_TO_FOCUS_MEDIA = 709;
  public static final int ERROR_SOUND_NOT_READY = 710;
  public static final int ERROR_OUT_OF_MEMORY_LOADING_MEDIA = 711;
  // SoundRecorder errors
  public static final int ERROR_SOUND_RECORDER = 801;
  public static final int ERROR_SOUND_RECORDER_CANNOT_CREATE = 802;
  // Form errors
  public static final int ERROR_INVALID_SCREEN_ORIENTATION = 901;
  public static final int ERROR_SCREEN_NOT_FOUND = 902;
  public static final int ERROR_SCREEN_BAD_VALUE_RECEIVED = 903;
  public static final int ERROR_SCREEN_BAD_VALUE_FOR_SENDING = 904;
  public static final int ERROR_SCREEN_INVALID_ANIMATION = 905;
  public static final int ERROR_NO_FOCUSABLE_VIEW_FOUND = 906;
  // Canvas errors
  public static final int ERROR_CANVAS_BITMAP_ERROR = 1001;
  public static final int ERROR_CANVAS_WIDTH_ERROR = 1002;
  public static final int ERROR_CANVAS_HEIGHT_ERROR = 1003;
  // Web errors
  public static final int ERROR_WEB_UNABLE_TO_GET = 1101;
  public static final int ERROR_WEB_UNSUPPORTED_ENCODING = 1102;
  public static final int ERROR_WEB_UNABLE_TO_POST_OR_PUT = 1103;
  public static final int ERROR_WEB_UNABLE_TO_POST_OR_PUT_FILE = 1104;
  public static final int ERROR_WEB_JSON_TEXT_DECODE_FAILED = 1105;
  public static final int ERROR_WEB_HTML_TEXT_DECODE_FAILED = 1106;
  // There is a gap here because two ContactPicker errors below use the numbers 1107 and 1108.
  public static final int ERROR_WEB_MALFORMED_URL = 1109;
  public static final int ERROR_WEB_REQUEST_HEADER_NOT_LIST = 1110;
  public static final int ERROR_WEB_REQUEST_HEADER_NOT_TWO_ELEMENTS = 1111;
  public static final int ERROR_WEB_BUILD_REQUEST_DATA_NOT_LIST = 1112;
  public static final int ERROR_WEB_BUILD_REQUEST_DATA_NOT_TWO_ELEMENTS = 1113;
  public static final int ERROR_WEB_UNABLE_TO_DELETE = 1114;
  public static final int ERROR_WEB_XML_TEXT_DECODE_FAILED = 1115;
  // Contact picker (and PhoneNumberPicker) errors
  public static final int ERROR_PHONE_UNSUPPORTED_CONTACT_PICKER = 1107;
  public static final int ERROR_PHONE_UNSUPPORTED_SEARCH_IN_CONTACT_PICKING = 1108;
  // Camcorder errors
  public static final int ERROR_CAMCORDER_NO_CLIP_RETURNED = 1201;
  // VideoPlayer errors
  public static final int ERROR_VIDEOPLAYER_FULLSCREEN_UNAVAILBLE = 1301;
  public static final int ERROR_VIDEOPLAYER_FULLSCREEN_CANT_EXIT = 1302;
  public static final int ERROR_VIDEOPLAYER_FULLSCREEN_UNSUPPORTED = 1303;
  // Arrangement errors
  public static final int ERROR_BAD_VALUE_FOR_HORIZONTAL_ALIGNMENT = 1401;
  public static final int ERROR_BAD_VALUE_FOR_VERTICAL_ALIGNMENT = 1402;
  // BarcodeScanner errors
  public static final int ERROR_NO_SCANNER_FOUND = 1501;
  // ImagePicker errors
  public static final int ERROR_CANNOT_SAVE_IMAGE = 1601;
  public static final int ERROR_CANNOT_COPY_MEDIA = 1602;

  // Texting errors
  public static final int ERROR_BAD_VALUE_FOR_TEXT_RECEIVING = 1701;

  // Repl Communication Errors
  public static final int ERROR_REPL_SECURITY_ERROR = 1801;
  // AccelerometerSensor Errors
  public static final int ERROR_BAD_VALUE_FOR_ACCELEROMETER_SENSITIVITY = 1901;

  //Sharing Errors
  public static final int ERROR_FILE_NOT_FOUND_FOR_SHARING = 2001;

  // File errors
  public static final int ERROR_CANNOT_FIND_FILE = 2101;
  public static final int ERROR_CANNOT_READ_FILE = 2102;
  public static final int ERROR_CANNOT_CREATE_FILE = 2103;
  public static final int ERROR_CANNOT_WRITE_TO_FILE = 2104;
  public static final int ERROR_CANNOT_DELETE_ASSET = 2105;
  public static final int ERROR_CANNOT_WRITE_ASSET = 2106;

  // Yandex.Translate errors
  public static final int ERROR_TRANSLATE_NO_KEY_FOUND = 2201;
  public static final int ERROR_TRANSLATE_SERVICE_NOT_AVAILABLE = 2202;
  public static final int ERROR_TRANSLATE_JSON_RESPONSE = 2203;

  // TimePicker errors
  public static final int ERROR_ILLEGAL_HOUR = 2301;
  public static final int ERROR_ILLEGAL_MINUTE = 2302;

  // DatePicker errors
  public static final int ERROR_ILLEGAL_DATE = 2401;

  // WebViewer errors
  public static final int ERROR_WEBVIEW_SSL_ERROR = 2501;

  //FusiontablesControl errors
  public static final int FUSION_TABLES_QUERY_ERROR = 2601;

  //TextToSpeech errors
  public static final int ERROR_TTS_NOT_READY = 2701;

  // AndroidViewComponent errors
  public static final int ERROR_BAD_PERCENT = 2801;

  // 2901-2999 are reserved for FIRST Tech Challenge.

  // Image errors
  public static final int ERROR_IMAGE_CANNOT_ROTATE = 3001;

--
Ok, so the kind of errors I want to store information about (programming bugs like the one on my second post) don't have an accesible event from AppInventor interface. 

Thank you Taifun for the info.

--

댓글 없음:

댓글 쓰기