From 33404b511c92c0b377d7147363f0ff5345a76dbf Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Mon, 18 Nov 2024 19:24:19 +0700 Subject: [PATCH] Set server error --- example/src/App.tsx | 19 ++++++++++++++----- example/src/server.ts | 7 ++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index 80d1022b..0f510ef3 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -13,7 +13,12 @@ import RNRestart from 'react-native-restart'; import Share from 'react-native-share'; import 'reflect-metadata'; import {createLargeDB, queryLargeDB} from './Database'; -import {setServerResults, startServer, stopServer} from './server'; +import { + setServerError, + setServerResults, + startServer, + stopServer, +} from './server'; import {constantsTests} from './tests/constants.spec'; import {registerHooksTests} from './tests/hooks.spec'; import {blobTests, dbSetupTests, queriesTests, runTests} from './tests/index'; @@ -40,10 +45,14 @@ export default function App() { constantsTests, reactiveTests, tokenizerTests, - ).then(results => { - setServerResults(results as any); - setResults(results); - }); + ) + .then(results => { + setServerResults(results as any); + setResults(results); + }) + .catch(e => { + setServerError(e); + }); startServer(); diff --git a/example/src/server.ts b/example/src/server.ts index 5adf82b4..c5451896 100644 --- a/example/src/server.ts +++ b/example/src/server.ts @@ -4,7 +4,6 @@ let results: any[] = []; const server = new BridgeServer('http_service', true); server.get('/ping', async (_req, _res) => { - // console.log("🟦 🟦🟦🟦🟦🟦🟦 🟦 Received request for '/ping'"); return {message: 'pong'}; }); @@ -23,5 +22,11 @@ export function stopServer() { } export function setServerResults(r: any[]) { + console.log('Setting server results'); results = r; } + +export function setServerError(e: any) { + console.log('Setting server error'); + results = e; +}