display errors
This commit is contained in:
@@ -45,12 +45,12 @@ function Level() {
|
|||||||
const connection = React.useContext(ConnectionContext)
|
const connection = React.useContext(ConnectionContext)
|
||||||
|
|
||||||
const level = useLoadLevelQuery({world: worldId, level: levelId})
|
const level = useLoadLevelQuery({world: worldId, level: levelId})
|
||||||
|
|
||||||
const {editor, infoProvider} = useLevelEditor(worldId, levelId, codeviewRef, infoviewRef)
|
const {editor, infoProvider} = useLevelEditor(worldId, levelId, codeviewRef, infoviewRef)
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<Box style={level.isLoading ? null : {display: "none"}} display="flex" alignItems="center" justifyContent="center" sx={{ height: "calc(100vh - 64px)" }}><CircularProgress /></Box>
|
<Box style={level.isLoading ? null : {display: "none"}} display="flex" alignItems="center" justifyContent="center" sx={{ height: "calc(100vh - 64px)" }}><CircularProgress /></Box>
|
||||||
<Grid style={level.isLoading ? {display: "none"} : null} className="level" container sx={{ mt: 3, ml: 1, mr: 1 }} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
|
<Box style={level.isError ? null : {display: "none"}} display="flex" alignItems="center" justifyContent="center" sx={{ height: "calc(100vh - 64px)" }}>{level?.error?.message}</Box>
|
||||||
|
<Grid style={level.isLoading || level.isError ? {display: "none"} : null} className="level" container sx={{ mt: 3, ml: 1, mr: 1 }} columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
|
||||||
<Grid xs={4} className="doc-panel">
|
<Grid xs={4} className="doc-panel">
|
||||||
<LeftPanel spells={level?.data?.tactics} inventory={level?.data?.tactics} />
|
<LeftPanel spells={level?.data?.tactics} inventory={level?.data?.tactics} />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
+10
-6
@@ -24,12 +24,16 @@ const customBaseQuery = async (
|
|||||||
{ signal, dispatch, getState, extra },
|
{ signal, dispatch, getState, extra },
|
||||||
extraOptions
|
extraOptions
|
||||||
) => {
|
) => {
|
||||||
const connection : Connection = extra.connection
|
try {
|
||||||
let leanClient = await connection.startLeanClient()
|
const connection : Connection = extra.connection
|
||||||
console.log(`Sending request ${args.method}`)
|
let leanClient = await connection.startLeanClient()
|
||||||
let res = await leanClient.sendRequest(args.method, args.params)
|
console.log(`Sending request ${args.method}`)
|
||||||
console.log('Received response', res)
|
let res = await leanClient.sendRequest(args.method, args.params)
|
||||||
return {'data': res}
|
console.log('Received response', res)
|
||||||
|
return {'data': res}
|
||||||
|
} catch (e) {
|
||||||
|
return {'error': e}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define a service using a base URL and expected endpoints
|
// Define a service using a base URL and expected endpoints
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
|
|||||||
let s ← get
|
let s ← get
|
||||||
let c ← read
|
let c ← read
|
||||||
let some lvl ← getLevel? {game := s.game, world := p.world, level := p.level}
|
let some lvl ← getLevel? {game := s.game, world := p.world, level := p.level}
|
||||||
| throwServerError s!"Level not found {(← getGame s.game).name} {p.world} {p.level}"
|
| do
|
||||||
|
c.hOut.writeLspResponseError ⟨id, .invalidParams, s!"Level not found: world {p.world}, level {p.level}", none⟩
|
||||||
|
return true
|
||||||
let levelInfo : LevelInfo :=
|
let levelInfo : LevelInfo :=
|
||||||
{ index := lvl.index,
|
{ index := lvl.index,
|
||||||
title := lvl.title,
|
title := lvl.title,
|
||||||
|
|||||||
Reference in New Issue
Block a user