001package com.box.sdkgen.box.errors;
002
003public class BoxSDKError extends RuntimeException {
004
005  public final String message;
006
007  public String timestamp;
008
009  public Exception error;
010
011  public String name;
012
013  public BoxSDKError(String message) {
014    super(message);
015    this.message = message;
016    this.name = "BoxSDKError";
017  }
018
019  public BoxSDKError(String message, Exception error) {
020    super(message, error);
021    this.message = message;
022    this.error = error;
023    this.name = "BoxSDKError";
024  }
025
026  protected BoxSDKError(Builder builder) {
027    super(builder.message, builder.error);
028    this.message = builder.message;
029    this.timestamp = builder.timestamp;
030    this.error = builder.error;
031    this.name = builder.name;
032  }
033
034  public String getMessage() {
035    return message;
036  }
037
038  public String getTimestamp() {
039    return timestamp;
040  }
041
042  public Object getError() {
043    return error;
044  }
045
046  public String getName() {
047    return name;
048  }
049
050  public static class Builder {
051
052    protected final String message;
053
054    protected String timestamp;
055
056    protected Exception error;
057
058    protected String name;
059
060    public Builder(String message) {
061      this.message = message;
062      this.name = "BoxSDKError";
063    }
064
065    public Builder timestamp(String timestamp) {
066      this.timestamp = timestamp;
067      return this;
068    }
069
070    public Builder error(Exception error) {
071      this.error = error;
072      return this;
073    }
074
075    public Builder name(String name) {
076      this.name = name;
077      return this;
078    }
079
080    public BoxSDKError build() {
081      return new BoxSDKError(this);
082    }
083  }
084}