MCPcopy Index your code
hub / github.com/cryptomator/cryptomator / of

Method of

src/main/java/org/cryptomator/common/ErrorCode.java:77–87  ·  view source on GitHub ↗

Deterministically creates an error code from the stack trace of the given cause . The code consists of three parts separated by DELIM: The first part depends on the root cause and the method that threw it The second part depends on the root cause an

(Throwable throwable)

Source from the content-addressed store, hash-verified

75 * @return A three-part error code
76 */
77 public static ErrorCode of(Throwable throwable) {
78 var causalChain = Throwables.getCausalChain(throwable);
79 if (causalChain.size() > 1) {
80 var rootCause = causalChain.get(causalChain.size() - 1);
81 var parentOfRootCause = causalChain.get(causalChain.size() - 2);
82 var rootSpecificFrames = countTopmostFrames(rootCause.getStackTrace(), parentOfRootCause.getStackTrace());
83 return new ErrorCode(throwable, rootCause, rootSpecificFrames);
84 } else {
85 return new ErrorCode(throwable, throwable, ALL_FRAMES);
86 }
87 }
88
89 private String format(int value) {
90 // Cut off highest 12 bits (only leave 20 least significant bits) and XOR rest with cutoff

Callers 15

testErrorCodeSegmentsMethod · 0.95
setupMethod · 0.95
setupMethod · 0.95
provideErrorCodeMethod · 0.95
loadUTF8PropertiesMethod · 0.80
NarrowedDownDictClass · 0.80

Calls 4

countTopmostFramesMethod · 0.95
sizeMethod · 0.80
getStackTraceMethod · 0.80
getMethod · 0.65

Tested by 15

testErrorCodeSegmentsMethod · 0.76
setupMethod · 0.76
setupMethod · 0.76
loadUTF8PropertiesMethod · 0.64
testCreateRecoveryKeyMethod · 0.64