Skip to content

Commit bef34e9

Browse files
committed
feat: fallback to using resp body as err msg when parsing fails
1 parent 26ec73f commit bef34e9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/dev/openfga/sdk/errors/FgaError.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public static Optional<FgaError> getError(
145145
error.setApiErrorCode(resp.getCode());
146146
error.setApiErrorMessage(resp.getMessage());
147147
} catch (JsonProcessingException e) {
148-
// Fall back, do nothing - log the exception for debugging
149-
System.err.println("Failed to parse API error response JSON: " + e.getMessage());
148+
// Fall back to using raw response body as error message if parsing fails
149+
error.setApiErrorMessage(body);
150150
}
151151
}
152152

0 commit comments

Comments
 (0)