fix unwrap causing panic (#5886)
updates Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -831,8 +831,7 @@ impl ExecutorContext {
|
||||
.await?;
|
||||
let (module_memory, _) = self
|
||||
.exec_module_for_items(id, exec_state, ExecutionKind::Isolated, source_range)
|
||||
.await
|
||||
.unwrap();
|
||||
.await?;
|
||||
|
||||
exec_state.mut_stack().memory.set_std(module_memory);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import { KCLError } from 'lang/errors'
|
||||
import { Diagnostic } from '@codemirror/lint'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import RustContext from 'lib/rustContext'
|
||||
import { EXECUTE_AST_INTERRUPT_ERROR_STRING } from 'lib/constants'
|
||||
|
||||
export type ToolTip =
|
||||
| 'lineTo'
|
||||
@ -116,10 +117,7 @@ function handleExecuteError(e: any): ExecutionResult {
|
||||
let isInterrupted = false
|
||||
if (e instanceof KCLError) {
|
||||
// Detect if it is a force interrupt error which is not a KCL processing error.
|
||||
if (
|
||||
e.msg ===
|
||||
'Failed to wait for promise from engine: JsValue("Force interrupt, executionIsStale, new AST requested")'
|
||||
) {
|
||||
if (e.msg.includes(EXECUTE_AST_INTERRUPT_ERROR_STRING)) {
|
||||
isInterrupted = true
|
||||
}
|
||||
return {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { Models } from '@kittycad/lib/dist/types/src'
|
||||
|
||||
export const APP_NAME = 'Modeling App'
|
||||
/** Search string in new project names to increment as an index */
|
||||
export const INDEX_IDENTIFIER = '$n'
|
||||
@ -83,9 +85,24 @@ export const TELEMETRY_RAW_FILE_NAME = 'raw-metrics.txt'
|
||||
export const PLAYWRIGHT_KEY = 'playwright'
|
||||
|
||||
/** Custom error message to match when rejectAllModelCommands is called
|
||||
* allows us to match if the execution of executeAst was interrupted */
|
||||
export const EXECUTE_AST_INTERRUPT_ERROR_MESSAGE =
|
||||
* allows us to match if the execution of executeAst was interrupted
|
||||
* This needs to be of type WebsocketResponse, so that we can parse it back out
|
||||
* nicely on the rust side.
|
||||
* */
|
||||
export const EXECUTE_AST_INTERRUPT_ERROR_STRING =
|
||||
'Force interrupt, executionIsStale, new AST requested'
|
||||
const EXECUTE_AST_INTERRUPT_ERROR: Models['WebSocketResponse_type'] = {
|
||||
success: false,
|
||||
errors: [
|
||||
{
|
||||
message: EXECUTE_AST_INTERRUPT_ERROR_STRING,
|
||||
error_code: 'bad_request',
|
||||
},
|
||||
],
|
||||
}
|
||||
export const EXECUTE_AST_INTERRUPT_ERROR_MESSAGE = JSON.stringify(
|
||||
EXECUTE_AST_INTERRUPT_ERROR
|
||||
)
|
||||
|
||||
/** The messages that appear for exporting toasts */
|
||||
export const EXPORT_TOAST_MESSAGES = {
|
||||
|
Reference in New Issue
Block a user