فهرست منبع

ts: Improve error message (#891)

Maximilian Schneider 4 سال پیش
والد
کامیت
0aeaac7c23
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      ts/src/program/context.ts

+ 5 - 1
ts/src/program/context.ts

@@ -72,7 +72,11 @@ export function splitArgsAndCtx(
   const inputLen = idlIx.args ? idlIx.args.length : 0;
   if (args.length > inputLen) {
     if (args.length !== inputLen + 1) {
-      throw new Error("provided too many arguments ${args}");
+      throw new Error(
+        `provided too many arguments ${args} to instruction ${
+          idlIx?.name
+        } expecting: ${idlIx.args?.map((a) => a.name) ?? []}`
+      );
     }
     options = args.pop();
   }