Beispiel #1
0
  /**
   * @see Message for default values to understand behaviour of overloaded methods broadcasts error
   *     and logs it
   */
  @Background
  public void showError(Message message) {
    if (message == null) {
      throw new IllegalArgumentException("null message");
    }
    ErrorType errorType = message.getType();
    String header = message.getHeader();
    String detail = message.getDetail();
    Integer logPriority = message.getLogPriority();

    String finalMessage;

    switch (message.getType()) {
      case REST_MINOR:
      case REST_MAJOR:
        finalMessage =
            context.getString(R.string.rest_request_failed, getConnectionDetails() + detail);
        break;
      default:
        finalMessage =
            header == null
                ? detail
                : context.getString(R.string.message_detailed_info, header, detail);
        break;
    }

    if (logPriority == null) {
      logPriority = errorType.getDefaultLogPriority();
    }

    showError(errorType, logPriority, finalMessage);
  }
  /* (non-Javadoc)
   * @see edu.ku.brc.ui.forms.validation.UIValidatable#validateState()
   */
  public ErrorType validateState() {
    ErrorType err = textField.validateState();
    if (isValidatingFile && err == ErrorType.Valid) {
      File file = new File(textField.getText());
      isValidFile = file.isFile() && file.exists();
    }

    ErrorType fileError =
        isValidatingFile && !isValidFile
            ? UIValidatable.ErrorType.Error
            : UIValidatable.ErrorType.Valid;

    return errorStatus = err.ordinal() > fileError.ordinal() ? err : fileError;
  }
Beispiel #3
0
  private void showError(ErrorType errorType, Integer logPriority, String msg) {
    Log.println(logPriority, TAG, msg);
    boolean failedRepeatedly = false;

    if (errorType.isConnectionType()) {
      ConnectionInfo connectionInfo = updateConnectionInfo(false, errorType.isNotifiable(), msg);
      failedRepeatedly = connectionInfo.getState() == ConnectionInfo.State.FAILED_REPEATEDLY;
    }

    Intent intent = new Intent(Broadcasts.ERROR_MESSAGE);
    intent.putExtra(Broadcasts.Extras.ERROR_REASON, msg);
    intent.putExtra(
        Broadcasts.Extras.REPEATED_MINOR_ERROR, failedRepeatedly && errorType.isMinorType());
    context.sendBroadcast(intent);
  }
Beispiel #4
0
 @Override
 public void onPlaybackError(ErrorType errorType, String errorDetails) {
   Log.d("MainActivity", "Playback error received: " + errorType.name());
   switch (errorType) {
       // Handle error type as necessary
     default:
       break;
   }
 }
Beispiel #5
0
 private LOGMESSAGE(String message, ErrorType type) {
   this.errorMessage = message;
   this.errorType = type.toString();
 }
 public Void visitErrorType(ErrorType type, Void ignore) {
   printType("originalType", type.getOriginalType(), Details.FULL);
   return visitClassType(type, null);
 }
 private void handleFailure(int statusCode, String error) {
   Log.i(TAG, "statusCode4=" + statusCode);
   error = ErrorType.errorMessage(context, ErrorType.ErrorApiForbidden);
   SafeHandler.onFailure(handler, error);
 }
Beispiel #8
0
 @Override
 public void onPlaybackError(ErrorType errorType, String errorDetails) {
   String errorName = errorType.name().toLowerCase(Locale.ENGLISH).replaceAll("_", " ");
   logStatus("Player error: " + errorName);
 }
 /* (non-Javadoc)
  * @see edu.ku.brc.ui.forms.validation.UIValidatable#getState()
  */
 public ErrorType getState() {
   return textField.getState().ordinal() > errorStatus.ordinal()
       ? textField.getState()
       : errorStatus;
 }
Beispiel #10
0
 @Override
 public JsonType visitError(ErrorType errorType, Void o) {
   throw new UnsupportedOperationException(errorType.toString());
 }
 @Override
 public Void visitErrorType(ErrorType t, Void ignored) {
   Type ot = t.getOriginalType();
   if (ot != null) visit(ot);
   return null;
 }
Beispiel #12
0
  static {
    errorDescs = new EnumMap<ErrorType, EnumMap<DetailErrorType, String>>(ErrorType.class);
    for (ErrorType type : ErrorType.values())
      errorDescs.put(type, new EnumMap<DetailErrorType, String>(DetailErrorType.class));

    errorDescs
        .get(ErrorType.GENERIC)
        .put(
            DetailErrorType.DISK_FULL,
            I18nMarker.marktr(
                "LimeWire was unable to write a necessary file because your hard drive is full. To continue using LimeWire you must free up space on your hard drive."));
    errorDescs
        .get(ErrorType.GENERIC)
        .put(
            DetailErrorType.FILE_LOCKED,
            I18nMarker.marktr(
                "LimeWire was unable to open a necessary file because another program has locked the file. LimeWire may act unexpectedly until this file is released."));
    errorDescs
        .get(ErrorType.GENERIC)
        .put(
            DetailErrorType.NO_PRIVS,
            I18nMarker.marktr(
                "LimeWire was unable to write a necessary file because you do not have the necessary permissions. Your preferences may not be maintained the next time you start LimeWire, or LimeWire may behave in unexpected ways."));
    errorDescs
        .get(ErrorType.GENERIC)
        .put(
            DetailErrorType.BAD_CHARS,
            I18nMarker.marktr(
                "LimeWire cannot open a necessary file because the filename contains characters which are not supported by your operating system. LimeWire may behave in unexpected ways."));

    errorDescs
        .get(ErrorType.DOWNLOAD)
        .put(
            DetailErrorType.DISK_FULL,
            I18nMarker.marktr(
                "LimeWire cannot download the selected file because your hard drive is full. To download more files, you must free up space on your hard drive."));
    errorDescs
        .get(ErrorType.DOWNLOAD)
        .put(
            DetailErrorType.FILE_LOCKED,
            I18nMarker.marktr(
                "LimeWire was unable to download the selected file because another program is using the file. Please close the other program and retry the download."));
    errorDescs
        .get(ErrorType.DOWNLOAD)
        .put(
            DetailErrorType.NO_PRIVS,
            I18nMarker.marktr(
                "LimeWire was unable to create or continue writing an incomplete file for the selected download because you do not have permission to write files to the incomplete folder. To continue using LimeWire, please choose a different Save Folder."));
    errorDescs
        .get(ErrorType.DOWNLOAD)
        .put(
            DetailErrorType.BAD_CHARS,
            I18nMarker.marktr(
                "LimeWire was unable to open the incomplete file for the selected download because the filename contains characters which are not supported by your operating system."));

    // just verify it was all setup right.
    for (ErrorType type : ErrorType.values()) {
      assert errorDescs.get(type) != null;
      assert errorDescs.get(type).size() == DetailErrorType.values().length;
    }
  }