-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the dapr runtime returned error details to the Java DaprException #998
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
139a230
properly add the dapr runtime returned error details to the Java Dapr…
cicoyle c97dd51
add error handling to sdk docs
cicoyle 783ebf2
add tests for the dapr exception changes
cicoyle cf64bc4
try verifyNoMoreInteractions w/ channel
cicoyle a402db2
verify channel close -> channel close explicitly
cicoyle c217129
rm verifyNoMoreInteractions
cicoyle f8ffb2d
rm test to see if that is the orphaned managed channel issue
cicoyle 967100e
re-add test since that doesnt seem to be the issue
cicoyle 69b0d68
channel.close(); -> verify(channel).close();
cicoyle eb96cf2
Merge branch 'master' into feat-err-standardization
artursouza d377fad
Rewrite and redesign of the DaprErrorDetail in DaprException.
artursouza d7b492d
Merge branch 'master' into feat-err-standardization
artursouza c23c685
Update daprdocs too for DaprErrorDetails.
artursouza 77975d8
Fix README.md mm string.
artursouza 896e997
Fix exception example.
artursouza 84ebb63
Use runtime 1.13.0-rc.2
artursouza 41a36ac
Fix exception example to match gRPC output.
artursouza 14c1880
Update error message in IT as per new Dapr runtime version.
artursouza 1cf7325
Dapr 1.13 is less tolerant of app downtime to keep timers.
artursouza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
import io.dapr.client.domain.Metadata; | ||
import io.dapr.config.Properties; | ||
import io.dapr.exceptions.DaprError; | ||
import io.dapr.exceptions.DaprErrorDetails; | ||
import io.dapr.exceptions.DaprException; | ||
import io.dapr.utils.Version; | ||
import okhttp3.Call; | ||
|
@@ -73,6 +74,11 @@ public class DaprHttp implements AutoCloseable { | |
private static final Set<String> ALLOWED_CONTEXT_IN_HEADERS = | ||
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("grpc-trace-bin", "traceparent", "tracestate"))); | ||
|
||
/** | ||
* Object mapper to parse DaprError with or without details. | ||
*/ | ||
private static final ObjectMapper DAPR_ERROR_DETAILS_OBJECT_MAPPER = new ObjectMapper(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarifying my change: no need for a custom ObjectMapper. The stock one is enough now. |
||
|
||
/** | ||
* HTTP Methods supported. | ||
*/ | ||
|
@@ -136,11 +142,6 @@ public int getStatusCode() { | |
*/ | ||
private static final byte[] EMPTY_BYTES = new byte[0]; | ||
|
||
/** | ||
* JSON Object Mapper. | ||
*/ | ||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); | ||
|
||
/** | ||
* Endpoint used to communicate to Dapr's HTTP endpoint. | ||
*/ | ||
|
@@ -347,12 +348,13 @@ private static DaprError parseDaprError(byte[] json) { | |
} | ||
|
||
try { | ||
return OBJECT_MAPPER.readValue(json, DaprError.class); | ||
return DAPR_ERROR_DETAILS_OBJECT_MAPPER.readValue(json, DaprError.class); | ||
} catch (IOException e) { | ||
throw new DaprException("UNKNOWN", new String(json, StandardCharsets.UTF_8)); | ||
} | ||
} | ||
|
||
|
||
private static byte[] getBodyBytesOrEmptyArray(okhttp3.Response response) throws IOException { | ||
ResponseBody body = response.body(); | ||
if (body != null) { | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifying my change: keeping this example simple.