mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-26 16:35:39 +00:00
Handle catching unknowns
This commit is contained in:
@@ -5,6 +5,7 @@ import * as java16 from '@mcschema/java-1.16'
|
||||
import * as java17 from '@mcschema/java-1.17'
|
||||
import config from '../config.json'
|
||||
import { fetchData } from './DataFetcher'
|
||||
import { message } from './Utils'
|
||||
|
||||
export const VersionIds = ['1.15', '1.16', '1.17'] as const
|
||||
export type VersionId = typeof VersionIds[number]
|
||||
@@ -55,7 +56,7 @@ async function getVersion(id: VersionId): Promise<VersionData> {
|
||||
Versions[id] = { collections, schemas, blockStates }
|
||||
return Versions[id]
|
||||
} catch (e) {
|
||||
throw new Error(`Cannot get version "${id}": ${e.message}`)
|
||||
throw new Error(`Cannot get version "${id}": ${message(e)}`)
|
||||
}
|
||||
})()
|
||||
return Versions[id]
|
||||
@@ -81,7 +82,7 @@ export async function getModel(version: VersionId, id: string): Promise<DataMode
|
||||
}
|
||||
Models[id] = { model, version }
|
||||
} catch (e) {
|
||||
throw new Error(`Cannot get generator "${id}" for version "${version}": ${e.message}`)
|
||||
throw new Error(`Cannot get generator "${id}" for version "${version}": ${message(e)}`)
|
||||
}
|
||||
}
|
||||
return Models[id].model
|
||||
|
||||
Reference in New Issue
Block a user