diff --git a/src/api/index.ts b/src/api/index.ts index 66d29e809..4c8be240a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -137,7 +137,6 @@ export async function callOld( let response; try { // handle axios errors - if (initial || force) { response = await promise; } else { @@ -154,7 +153,7 @@ export async function callOld( 'Request': request, 'Error Path': error.path, 'Variables': variables ?? {}, - 'Response Data': response.data.data + 'Response Data': response.data.data, }); printApiError(error, response.data, request, variables); @@ -177,7 +176,6 @@ export async function callOld( * @deprecated old format. See method jsdoc */ return response.data.data; - } catch (error) { console.error('API Request Error', error); @@ -185,7 +183,7 @@ export async function callOld( request, variables: variables ?? {}, response: response?.data, - }) + }); throw error; } } diff --git a/src/hawk.ts b/src/hawk.ts index e34ee750b..7d8f087ba 100644 --- a/src/hawk.ts +++ b/src/hawk.ts @@ -1,4 +1,4 @@ -import HawkCatcher, { HawkInitialSettings, HawkJavaScriptEvent } from '@hawk.so/javascript'; +import HawkCatcher, { HawkInitialSettings, HawkJavaScriptEvent } from '@hawk.so/javascript' import type Vue from 'vue'; /** @@ -31,7 +31,10 @@ let hawk: HawkCatcher | null = null; /** * Composable for tracking errors via Hawk.so */ -export function useErrorTracker() { +export function useErrorTracker(): { + initHawk: (options: ErrorTrackerInitialOptions) => void; + track: (...args: Parameters) => void; + } { /** * Initialize Hawk.so * @@ -59,14 +62,14 @@ export function useErrorTracker() { * @param error - error to track * @param context - additional context */ - function track(error: Parameters[0], context?: Parameters[1]): void { + function track(...args: Parameters): void { if (hawk) { - hawk.send(error, context); + hawk.send(...args); } } return { initHawk, - track - } + track, + }; }