All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.weaverplatform.protocol.WeaverError Maven / Gradle / Ivy

package com.weaverplatform.protocol;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;

public class WeaverError extends RuntimeException {

  public final static int
    NODE_NOT_FOUND             = 101,
    NODE_ALREADY_EXISTS        = 161,
    PERMISSION_DENIED          = 200,
    DATATYPE_INVALID           = 322,
    DATATYPE_UNSUPPORTED       = 333,
    WRITE_OPERATION_NOT_EXISTS = 344,
    WRITE_OPERATION_INVALID    = 345,
    WRITE_OPERATION_FAILED     = 366,
    INCREMENT_ERROR            = 346,
    QUERY_INVALID              = 356,
    SQL_EXCEPTION              = 399,
    CONDITION_INVALID          = 442,
    DATABASE_NOT_PROVIDED      = 443,
    RESULTSET_ERROR            = 743,
    DATABASE_CONNECTION        = 876,
    TRANSACTION_ERROR          = 880;

  @Expose
  private int code;

  @Expose
  private String message;

  private final static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();

  public WeaverError(int code, String message) {
    super(message);
    this.code = code;
    this.message = message;
  }

  public String toJson() {
    return gson.toJson(this);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy