{"record":{"id":"3bd2aa9e671c94cf","repo":"xpipe-io/xpipe","slug":"error-getmessage-optional-documentationlink-a","errorCode":null,"errorMessage":"error.getMessage() (+ optional documentationLink appended: \"For more information and troubleshooting steps, see: \" + documentationLink)","messagePattern":"error\\.getMessage\\(\\) \\(\\+ optional documentationLink appended: \"For more information and troubleshooting steps, see: \" \\+ documentationLink\\)","errorType":"exception","errorClass":"BeaconServerException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/BeaconServerErrorResponse.java","lineNumber":23,"sourceCode":"import lombok.Value;\nimport lombok.extern.jackson.Jacksonized;\n\n@SuppressWarnings(\"ClassCanBeRecord\")\n@Value\n@Builder\n@Jacksonized\n@AllArgsConstructor\npublic class BeaconServerErrorResponse {\n\n    Throwable error;\n    String documentationLink;\n\n    public void throwError() throws BeaconServerException {\n        var message = error.getMessage();\n        if (documentationLink != null) {\n            message = message + \"\\n\\nFor more information and troubleshooting steps, see: \" + documentationLink;\n        }\n        throw new BeaconServerException(message, error);\n    }\n}\n","sourceCodeStart":5,"sourceCodeEnd":26,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/BeaconServerErrorResponse.java#L5-L26","documentation":"BeaconServerErrorResponse.throwError converts a structured error returned by the xpipe daemon into a BeaconServerException on the client side, using the server-supplied message, optionally appending a documentation link if present. This is the standard way server-side failures surface to API consumers.","triggerScenarios":"Any beacon request that the daemon answers with an error object (e.g. invalid request data, failed operation on the daemon side) followed by the client calling throwError() on the received response.","commonSituations":"Invalid UUIDs or category ids passed to daemon APIs; operations rejected because a resource doesn't exist; server-side exceptions serialized into the error response and re-thrown locally.","solutions":["Read error.getMessage() in the thrown BeaconServerException — it describes the actual daemon-side problem.","Fix the request payload that the daemon rejected (correct ids, valid state) before retrying.","Follow the appended documentationLink for troubleshooting steps specific to the server error.","Catch BeaconServerException and use getError() to branch on the structured error instead of string matching."],"exampleFix":"// before\ntry { client.performRequest(req); } catch (Exception e) { e.printStackTrace(); }\n// after\ntry {\n    client.performRequest(req);\n} catch (BeaconServerException e) {\n    LOG.error(\"Daemon rejected request: {} (see {})\", e.getMessage(), docLinkFrom(e));\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    client.performRequest(req);\n} catch (BeaconServerException e) {\n    LOG.error(\"Daemon error: {}\", e.getMessage());\n    // documentationLink, when present, is appended to e.getMessage()\n}","preventionTips":["Validate all ids and payloads client-side before sending","Read error.getMessage() and the appended documentationLink rather than guessing","Branch on the structured error object, not on message strings"],"tags":["beacon","server-error","api"],"backgroundTag":"api-error-response","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}