@wandelbots/nova-js 3.3.1 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/errorHandling.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ function makeShortErrorMessage(err) {
|
|
|
21
21
|
* the specific error code and provide a localized app-specific error message.
|
|
22
22
|
*/
|
|
23
23
|
function makeErrorMessage(err) {
|
|
24
|
-
if (
|
|
24
|
+
if ((0, axios.isAxiosError)(err)) {
|
|
25
25
|
if (err.response) return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || "accessing"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`;
|
|
26
26
|
else if (err.config) if (err.code === "ERR_NETWORK") return `${err.message} from ${err.config.method?.toUpperCase() || "accessing"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`;
|
|
27
27
|
else return `${err.message} from ${err.config.method?.toUpperCase() || "accessing"} ${err.config.url}`;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["tryStringifyJson"],"sources":["../src/lib/errorHandling.ts"],"sourcesContent":["import { isAxiosError } from \"axios\"\nimport { tryStringifyJson } from \"./converters\"\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code\n */\nexport function makeShortErrorMessage(err: unknown) {\n return makeErrorMessage(err)\n}\n\n/**\n * Attempts to make a helpful error message from an unknown thrown error\n * or promise rejection.\n *\n * This function is mainly to aid debugging and good bug reports. For\n * expected errors encountered by end users, it's more ideal to catch\n * the specific error code and provide a localized app-specific error message.\n */\nexport function makeErrorMessage(err: unknown): string {\n if (isAxiosError(err)) {\n if (err.response) {\n return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || \"accessing\"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`\n } else if (err.config) {\n if (err.code === \"ERR_NETWORK\") {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`\n } else {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}`\n }\n }\n } else if (err instanceof Error) {\n return err.message\n } else if (typeof err === \"string\") {\n return err\n } else if (typeof err === \"object\") {\n return tryStringifyJson(err) || `Unserializable object ${err}`\n }\n\n return `${err}`\n}\n"],"mappings":";;;;;AAGA,SAAgB,MAAM,IAAY;AAChC,QAAO,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;AAM1D,SAAgB,sBAAsB,KAAc;AAClD,QAAO,iBAAiB,IAAI;;;;;;;;;;AAW9B,SAAgB,iBAAiB,KAAsB;AACrD,6BAAiB,IAAI,EACnB;MAAI,IAAI,SACN,QAAO,GAAG,IAAI,UAAU,OAAO,GAAG,IAAI,UAAU,WAAW,QAAQ,IAAI,UAAU,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,UAAU,OAAO,IAAI,IAAI,KAAK,UAAU,IAAI,UAAU,KAAK;WACtL,IAAI,OACb,KAAI,IAAI,SAAS,cACf,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO,IAAI;MAEhG,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO;YAGvF,eAAe,MACxB,QAAO,IAAI;UACF,OAAO,QAAQ,SACxB,QAAO;UACE,OAAO,QAAQ,SACxB,QAAOA,oCAAiB,IAAI,IAAI,yBAAyB;AAG3D,QAAO,GAAG"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/LoginWithAuth0.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAIM,gBAAA,CAAgB;EAyCT,SAAA,EAAA,OAAA;2BAtCc,QAAQ;;;ECLnB,SAAA,CAAA,GAAA,EAAY,MAAA,EAAA,KAAA,EAAA,MAAA,CAAA,EAAA,IAAA,GAAA,SAAA;EASZ,SAAA,CAAA,GAAA,EAAA,MAAgB,CAAA,EAAA,MAAA,GAAA,IAAA;AAahC;AAMgB,cDeH,gBCfmB,EDeH,gBCfG;;;;iBA5BhB,YAAA;;iBASA,gBAAA;;ADkChB;;;;AC3CgB,iBAsBA,kBAAA,CAtBY,GAAA,EAsBY,MAtBZ,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA,EAAA,MAAA;AAS5B;AAagB,iBAMA,gBAAA,CANwB,OAAM,EAAA,MAAA,CAAA,EAAA,MAAA;AAM9C;AAKgB,iBAAA,gBAAA,CAAgB,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAQhC;AAaA;;;iBAbgB,sBAAA;ACxChB;AAOA;AAYA;cDkCa;;;EElBA,CAAA,EAAA,MAAA;;;;iBDnCG,KAAA,cAAgB;;;;AFC1B,iBEMU,qBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/availableStorage.ts","../src/lib/converters.ts","../src/lib/errorHandling.ts","../src/LoginWithAuth0.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAIM,gBAAA,CAAgB;EAyCT,SAAA,EAAA,OAAA;2BAtCc,QAAQ;;;ECLnB,SAAA,CAAA,GAAA,EAAY,MAAA,EAAA,KAAA,EAAA,MAAA,CAAA,EAAA,IAAA,GAAA,SAAA;EASZ,SAAA,CAAA,GAAA,EAAA,MAAgB,CAAA,EAAA,MAAA,GAAA,IAAA;AAahC;AAMgB,cDeH,gBCfmB,EDeH,gBCfG;;;;iBA5BhB,YAAA;;iBASA,gBAAA;;ADkChB;;;;AC3CgB,iBAsBA,kBAAA,CAtBY,GAAA,EAsBY,MAtBZ,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA,EAAA,MAAA;AAS5B;AAagB,iBAMA,gBAAA,CANwB,OAAM,EAAA,MAAA,CAAA,EAAA,MAAA;AAM9C;AAKgB,iBAAA,gBAAA,CAAgB,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAQhC;AAaA;;;iBAbgB,sBAAA;ACxChB;AAOA;AAYA;cDkCa;;;EElBA,CAAA,EAAA,MAAA;;;;iBDnCG,KAAA,cAAgB;;;;AFC1B,iBEMU,qBAAA,CFHW,GAAO,EAAA,OAAA,CAAA,EAAA,MAAA;AAsClC;;;;AC3CA;AASA;AAaA;AAMA;AAKgB,iBCbA,gBAAA,CDagB,GAAA,EAAA,OAAA,CAAA,EAAA,MAAA;;;;;;;;ADUnB,cGPA,cHOgB,EAAA,CAAA,WAAA,EAAA,MAAyB,EAAA,GGLnD,OHKmD,CAAA,MAAA,GAAA,IAAA,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as availableStorage, r as AutoReconnectingWebsocket, t as loginWithAuth0 } from "./LoginWithAuth0-wQB-Sol1.mjs";
|
|
2
2
|
import { c as degreesToRadians, d as radiansToDegrees, f as tryParseJson, l as isSameCoordinateSystem, o as poseToWandelscriptString, p as tryStringifyJson, s as XYZ_TO_VECTOR, t as NovaClient, u as makeUrlQueryString } from "./NovaClient-B8XM3OPO.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { isAxiosError } from "axios";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/errorHandling.ts
|
|
6
6
|
function delay(ms) {
|
|
@@ -21,7 +21,7 @@ function makeShortErrorMessage(err) {
|
|
|
21
21
|
* the specific error code and provide a localized app-specific error message.
|
|
22
22
|
*/
|
|
23
23
|
function makeErrorMessage(err) {
|
|
24
|
-
if (err
|
|
24
|
+
if (isAxiosError(err)) {
|
|
25
25
|
if (err.response) return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || "accessing"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`;
|
|
26
26
|
else if (err.config) if (err.code === "ERR_NETWORK") return `${err.message} from ${err.config.method?.toUpperCase() || "accessing"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`;
|
|
27
27
|
else return `${err.message} from ${err.config.method?.toUpperCase() || "accessing"} ${err.config.url}`;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/errorHandling.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/errorHandling.ts"],"sourcesContent":["import { isAxiosError } from \"axios\"\nimport { tryStringifyJson } from \"./converters\"\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code\n */\nexport function makeShortErrorMessage(err: unknown) {\n return makeErrorMessage(err)\n}\n\n/**\n * Attempts to make a helpful error message from an unknown thrown error\n * or promise rejection.\n *\n * This function is mainly to aid debugging and good bug reports. For\n * expected errors encountered by end users, it's more ideal to catch\n * the specific error code and provide a localized app-specific error message.\n */\nexport function makeErrorMessage(err: unknown): string {\n if (isAxiosError(err)) {\n if (err.response) {\n return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || \"accessing\"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`\n } else if (err.config) {\n if (err.code === \"ERR_NETWORK\") {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}. This error can happen because of either connection issues or server CORS policy.`\n } else {\n return `${err.message} from ${err.config.method?.toUpperCase() || \"accessing\"} ${err.config.url}`\n }\n }\n } else if (err instanceof Error) {\n return err.message\n } else if (typeof err === \"string\") {\n return err\n } else if (typeof err === \"object\") {\n return tryStringifyJson(err) || `Unserializable object ${err}`\n }\n\n return `${err}`\n}\n"],"mappings":";;;;;AAGA,SAAgB,MAAM,IAAY;AAChC,QAAO,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;AAM1D,SAAgB,sBAAsB,KAAc;AAClD,QAAO,iBAAiB,IAAI;;;;;;;;;;AAW9B,SAAgB,iBAAiB,KAAsB;AACrD,KAAI,aAAa,IAAI,EACnB;MAAI,IAAI,SACN,QAAO,GAAG,IAAI,UAAU,OAAO,GAAG,IAAI,UAAU,WAAW,QAAQ,IAAI,UAAU,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,UAAU,OAAO,IAAI,IAAI,KAAK,UAAU,IAAI,UAAU,KAAK;WACtL,IAAI,OACb,KAAI,IAAI,SAAS,cACf,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO,IAAI;MAEhG,QAAO,GAAG,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,aAAa,IAAI,YAAY,GAAG,IAAI,OAAO;YAGvF,eAAe,MACxB,QAAO,IAAI;UACF,OAAO,QAAQ,SACxB,QAAO;UACE,OAAO,QAAQ,SACxB,QAAO,iBAAiB,IAAI,IAAI,yBAAyB;AAG3D,QAAO,GAAG"}
|
package/package.json
CHANGED
package/src/lib/errorHandling.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isAxiosError } from "axios"
|
|
2
2
|
import { tryStringifyJson } from "./converters"
|
|
3
3
|
|
|
4
4
|
export function delay(ms: number) {
|
|
@@ -21,7 +21,7 @@ export function makeShortErrorMessage(err: unknown) {
|
|
|
21
21
|
* the specific error code and provide a localized app-specific error message.
|
|
22
22
|
*/
|
|
23
23
|
export function makeErrorMessage(err: unknown): string {
|
|
24
|
-
if (err
|
|
24
|
+
if (isAxiosError(err)) {
|
|
25
25
|
if (err.response) {
|
|
26
26
|
return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.method?.toUpperCase() || "accessing"} ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`
|
|
27
27
|
} else if (err.config) {
|