mirror of
https://github.com/michivonah/themepark-assistant.git
synced 2025-12-24 23:16:29 +01:00
improve error handling in background jobs #3
This commit is contained in:
parent
6a60e3c10a
commit
04ae271e1e
8 changed files with 75 additions and 27 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { getDbEnv } from '../db/client'
|
||||
import { themepark } from '../db/schema'
|
||||
import { countryCodesDE } from '../lib/countries'
|
||||
import { BackgroundFetchError, ThemeparkUpdateError } from '../errors/background-error'
|
||||
import httpRequest from '../lib/http-request'
|
||||
import asyncBatchJob from '../lib/async-batch-job'
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ async function fetchThemeparks(
|
|||
return result;
|
||||
}
|
||||
catch(e){
|
||||
throw new Error(`Fetching themeparks failed: ${e}`);
|
||||
throw new BackgroundFetchError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +68,6 @@ export async function updateThemeparkData(env: Env): Promise<void>{
|
|||
}
|
||||
}
|
||||
catch(e){
|
||||
console.error(`Failed to update themepark data: ${e}`);
|
||||
throw new ThemeparkUpdateError(e);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue