Skip to content

Commit 77b59ea

Browse files
committed
For now, only return param errors in handlers.
1 parent a2d8e8b commit 77b59ea

File tree

2 files changed

+1
-66
lines changed

2 files changed

+1
-66
lines changed

src/frontend/src/lib/stores/channelHandlers/attributes.ts

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { retryFor, throwCanisterError, waitForStore } from "$lib/utils/utils";
1818
import { z } from "zod";
1919
import type { ChannelError } from "$lib/stores/channelStore";
2020

21+
2122
/**
2223
* Resolves the config issuer string from the current authentication state.
2324
* Returns `undefined` if the user did not authenticate via OpenID.
@@ -76,14 +77,6 @@ export const handleLegacyAttributes =
7677
dapp?.certifiedAttributes !== true &&
7778
frontendCanisterConfig.fetch_root_key[0] !== true
7879
) {
79-
await channel.send({
80-
jsonrpc: "2.0",
81-
id: request.id,
82-
error: {
83-
code: INVALID_PARAMS_ERROR_CODE,
84-
message: "Attributes are not available for this origin.",
85-
},
86-
});
8780
return;
8881
}
8982

@@ -103,14 +96,6 @@ export const handleLegacyAttributes =
10396
derivationOrigin: paramsResult.data.icrc95DerivationOrigin,
10497
});
10598
if (validationResult.result === "invalid") {
106-
await channel.send({
107-
jsonrpc: "2.0",
108-
id: request.id,
109-
error: {
110-
code: INVALID_PARAMS_ERROR_CODE,
111-
message: "Unverified derivation origin",
112-
},
113-
});
11499
onError("unverified-origin");
115100
return;
116101
}
@@ -175,15 +160,6 @@ export const handleLegacyAttributes =
175160
});
176161
} catch (error) {
177162
console.error(error);
178-
await channel.send({
179-
jsonrpc: "2.0",
180-
id: request.id,
181-
error: {
182-
code: 1000,
183-
message:
184-
"Encountered an internal error while processing the request.",
185-
},
186-
});
187163
}
188164
};
189165

@@ -220,14 +196,6 @@ export const handleIcrc3Attributes =
220196
dapp?.certifiedAttributes !== true &&
221197
frontendCanisterConfig.fetch_root_key[0] !== true
222198
) {
223-
await channel.send({
224-
jsonrpc: "2.0",
225-
id: request.id,
226-
error: {
227-
code: INVALID_PARAMS_ERROR_CODE,
228-
message: "Attributes are not available for this origin.",
229-
},
230-
});
231199
return;
232200
}
233201

@@ -247,14 +215,6 @@ export const handleIcrc3Attributes =
247215
derivationOrigin: paramsResult.data.icrc95DerivationOrigin,
248216
});
249217
if (validationResult.result === "invalid") {
250-
await channel.send({
251-
jsonrpc: "2.0",
252-
id: request.id,
253-
error: {
254-
code: INVALID_PARAMS_ERROR_CODE,
255-
message: "Unverified derivation origin",
256-
},
257-
});
258218
onError("unverified-origin");
259219
return;
260220
}
@@ -311,14 +271,5 @@ export const handleIcrc3Attributes =
311271
});
312272
} catch (error) {
313273
console.error(error);
314-
await channel.send({
315-
jsonrpc: "2.0",
316-
id: request.id,
317-
error: {
318-
code: 1000,
319-
message:
320-
"Encountered an internal error while processing the request.",
321-
},
322-
});
323274
}
324275
};

src/frontend/src/lib/stores/channelHandlers/delegation.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ export const handleDelegationRequest =
5656
derivationOrigin: params.icrc95DerivationOrigin,
5757
});
5858
if (validationResult.result === "invalid") {
59-
await channel.send({
60-
jsonrpc: "2.0",
61-
id: request.id,
62-
error: {
63-
code: INVALID_PARAMS_ERROR_CODE,
64-
message: "Unverified derivation origin",
65-
},
66-
});
6759
onError("unverified-origin");
6860
return;
6961
}
@@ -122,14 +114,6 @@ export const handleDelegationRequest =
122114
});
123115
} catch (error) {
124116
console.error(error);
125-
await channel.send({
126-
jsonrpc: "2.0",
127-
id: request.id,
128-
error: {
129-
code: INVALID_PARAMS_ERROR_CODE,
130-
message: error instanceof Error ? error.message : "Delegation failed",
131-
},
132-
});
133117
onError("delegation-failed");
134118
}
135119
};

0 commit comments

Comments
 (0)