-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add details to APIError and DatabricksError
Add details field to APIError and DatabricksError to contain the details of the errors returned by the API. Also add a method to return the details of type ErrorInfo.
- Loading branch information
1 parent
0337b77
commit 843980d
Showing
6 changed files
with
209 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
databricks-sdk-java/src/main/java/com/databricks/sdk/core/error/ErrorDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.databricks.sdk.core.error; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class ErrorDetail { | ||
|
||
private String type; | ||
|
||
private String reason; | ||
|
||
private String domain; | ||
|
||
private Map<String, String> metadata; | ||
|
||
public ErrorDetail() {} | ||
|
||
public ErrorDetail( | ||
@JsonProperty("@type") String type, | ||
@JsonProperty("reason") String reason, | ||
@JsonProperty("domain") String domain, | ||
@JsonProperty("metadata") Map<String, String> metadata) { | ||
this.type = type; | ||
this.reason = reason; | ||
this.domain = domain; | ||
this.metadata = Collections.unmodifiableMap(metadata); | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getReason() { | ||
return reason; | ||
} | ||
|
||
public void setReason(String reason) { | ||
this.reason = reason; | ||
} | ||
|
||
public void setDomain(String domain) { | ||
this.domain = domain; | ||
} | ||
|
||
public Map<String, String> getMetadata() { | ||
return metadata; | ||
} | ||
|
||
public void setMetadata(Map<String, String> metadata) { | ||
this.metadata = metadata; | ||
} | ||
|
||
public String getDomain() { | ||
return domain; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ErrorDetails{" | ||
+ "type='" | ||
+ type | ||
+ '\'' | ||
+ ", reason='" | ||
+ reason | ||
+ '\'' | ||
+ ", domain='" | ||
+ domain | ||
+ '\'' | ||
+ ", metadata=" | ||
+ metadata | ||
+ '}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters