Skip to content

Commit

Permalink
Enable passing all convex values via ConvexError (#22920)
Browse files Browse the repository at this point in the history
I believe we didn't properly support errors containing Convex values that weren't identical in their JSON encoded format (so bigint and bytes). I changed our existing tests to use a bigint instead of a number and then made changes until they all passed.

GitOrigin-RevId: a15c3edea45d86ba0afa14b633ba12b869bca0d9
  • Loading branch information
sshader authored and Convex, Inc. committed Mar 13, 2024
1 parent 7ca39a9 commit b8c90f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/browser/logging.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// This is blue #9 from https://www.radix-ui.com/docs/colors/palette-composition/the-scales

import { ConvexError, Value } from "../values";
import { ConvexError, Value } from "../values/index.js";
import { FunctionFailure } from "./sync/function_result";

// This is blue #9 from https://www.radix-ui.com/docs/colors/palette-composition/the-scales
// It must look good in both light and dark mode.
const INFO_COLOR = "color:rgb(0, 145, 255)";

Expand Down
3 changes: 2 additions & 1 deletion src/server/impl/syscall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ConvexError } from "../../values/errors.js";
import { jsonToConvex } from "../../values/value.js";

declare const Convex: {
syscall: (op: string, jsonArgs: string) => string;
Expand Down Expand Up @@ -45,7 +46,7 @@ export async function performAsyncSyscall(
// This only happens if we're propagating ConvexErrors
if (e.data !== undefined) {
const rethrown = new ConvexError(e.message);
rethrown.data = e.data;
rethrown.data = jsonToConvex(e.data);
throw rethrown;
}
throw new Error(e.message);
Expand Down

0 comments on commit b8c90f0

Please sign in to comment.