-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-sdk.js
More file actions
38 lines (28 loc) · 1.51 KB
/
Copy pathtest-sdk.js
File metadata and controls
38 lines (28 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Test importing the SDK using the package name (via pnpm workspace)
// Make sure you have run `pnpm install` in the root after adding the SDK
// Also ensure the SDK has been built (`pnpm --filter sdk build`)
import { setKey, patch } from 'errly'; // Use package name defined in root package.json
async function runTest() {
console.log('Import successful via package name!');
// --- IMPORTANT: Replace with the actual API Key from your Supabase 'projects' table ---
const apiKey = 'e8afc368-f5be-428b-9e0b-4fe4ffb701f8';
if (apiKey === 'PASTE_YOUR_API_KEY_HERE') {
console.error('Please replace PASTE_YOUR_API_KEY_HERE in test-sdk.js with your actual API key.');
return;
}
setKey(apiKey);
patch(); // Patch console.error to use console.ext
console.log('SDK Initialized and console patched.');
// Trigger an error using the patched console
// Add a timestamp to make the message unique each time
const timestamp = new Date().toISOString();
console.error(`This is a test error sent via console.error -> console.ext [${timestamp}]`);
// Example with an actual Error object:
// console.error(new Error('This is an actual Error object test.'));
// You can also call console.ext directly if needed, though patching .error is the primary use case
// console.ext('Direct call to console.ext', new Error('Another test error'));
console.log("Test error sent. Check your API server logs and Supabase 'errors' table.");
}
runTest().catch(err => {
console.error('Error running test script:', err);
});