-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ashtynmo/master
Add more specific exceptions for deleteDashboard and getDashboard
- Loading branch information
Showing
3 changed files
with
63 additions
and
8 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
23 changes: 23 additions & 0 deletions
23
src/main/java/com/appnexus/grafana/exceptions/GrafanaDashboardCouldNotDeleteException.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,23 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package com.appnexus.grafana.exceptions; | ||
|
||
import java.io.IOException; | ||
import okhttp3.ResponseBody; | ||
|
||
public class GrafanaDashboardCouldNotDeleteException extends GrafanaException { | ||
|
||
public static GrafanaDashboardCouldNotDeleteException withErrorBody(ResponseBody body) | ||
throws IOException { | ||
return body != null | ||
? new GrafanaDashboardCouldNotDeleteException("Unexpected Grafana error; " + body.string()) | ||
: new GrafanaDashboardCouldNotDeleteException("Unexpected Grafana error"); | ||
} | ||
|
||
public GrafanaDashboardCouldNotDeleteException(String message) { | ||
super(message); | ||
} | ||
|
||
public GrafanaDashboardCouldNotDeleteException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/appnexus/grafana/exceptions/GrafanaDashboardDoesNotExistException.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,23 @@ | ||
/* Licensed under Apache-2.0 */ | ||
package com.appnexus.grafana.exceptions; | ||
|
||
import java.io.IOException; | ||
import okhttp3.ResponseBody; | ||
|
||
public class GrafanaDashboardDoesNotExistException extends GrafanaException { | ||
|
||
public static GrafanaDashboardDoesNotExistException withErrorBody(ResponseBody body) | ||
throws IOException { | ||
return body != null | ||
? new GrafanaDashboardDoesNotExistException("Unexpected Grafana error; " + body.string()) | ||
: new GrafanaDashboardDoesNotExistException("Unexpected Grafana error"); | ||
} | ||
|
||
public GrafanaDashboardDoesNotExistException(String message) { | ||
super(message); | ||
} | ||
|
||
public GrafanaDashboardDoesNotExistException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |