Skip to content

Commit d847b82

Browse files
committed
Support actually logging out the intent response for the error case.
1 parent 0aa83cb commit d847b82

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main/java/org/medicmobile/webapp/mobile/ChtExternalAppHandler.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ public class ChtExternalAppHandler {
2727
}
2828

2929
String processResult(int resultCode, Intent intent) {
30-
if (resultCode != RESULT_OK) {
31-
String message = "ChtExternalAppHandler :: Bad result code: %s. The external app either: " +
32-
"explicitly returned this result, didn't return any result or crashed during the operation.";
33-
34-
warn(this, message, resultCode);
35-
return safeFormat("console.error('" + message + "')", resultCode);
36-
}
37-
3830
try {
3931
Optional<JSONObject> json = new ChtExternalApp
4032
.Response(intent, this.context)
4133
.getData();
4234
String data = json.map(JSONObject::toString).orElse(null);
35+
36+
if (resultCode != RESULT_OK) {
37+
String message = "ChtExternalAppHandler :: Bad result code: %s. The external app either: " +
38+
"explicitly returned this result, did not return any result or crashed during the operation. "
39+
+ data;
40+
41+
warn(this, message, resultCode);
42+
return safeFormat("console.error('" + message + "')", resultCode);
43+
}
44+
4345
return makeJavaScript(data);
4446

4547
} catch (Exception exception) {

0 commit comments

Comments
 (0)