mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-29 08:12:56 +00:00
error handling improvements
This commit is contained in:
@@ -157,7 +157,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
export let inputCat: InputCat = 'string'
|
||||
$: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncoding)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
return 'jpeg'
|
||||
} else if (keys.length == 1 && keys[0] == 'file') {
|
||||
return 'file'
|
||||
} else if (keys.length == 1 && keys[0] == 'error' && typeof result['error'] == 'string') {
|
||||
} else if (keys.length == 1 && keys[0] == 'error') {
|
||||
return 'error'
|
||||
} else if (
|
||||
keys.length == 3 &&
|
||||
@@ -141,8 +141,9 @@
|
||||
>Download</a
|
||||
>
|
||||
</div>
|
||||
{:else if !forceJson && resultKind == 'error'}<div
|
||||
><pre class="text-sm text-red-500 whitespace-pre-wrap">{result.error}</pre>
|
||||
{:else if !forceJson && resultKind == 'error'}<div>
|
||||
<span class="text-red-500 font-semibold">{result.error.name}: {result.error.message}</span>
|
||||
<pre class="text-sm whitespace-pre-wrap text-gray-900">{result.error.stack}</pre>
|
||||
</div>
|
||||
{:else if !forceJson && resultKind == 'approval'}<div class="flex flex-col gap-1 mx-4">
|
||||
<Button
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
let monacoTemplate: TemplateEditor | undefined = undefined
|
||||
let argInput: ArgInput | undefined = undefined
|
||||
|
||||
let inputCat: InputCat = computeInputCat(
|
||||
$: inputCat = computeInputCat(
|
||||
schema.properties[argName].type,
|
||||
schema.properties[argName].format,
|
||||
schema.properties[argName].items?.type,
|
||||
@@ -269,7 +269,6 @@
|
||||
bind:itemsType={schema.properties[argName].items}
|
||||
properties={schema.properties[argName].properties}
|
||||
displayHeader={false}
|
||||
bind:inputCat
|
||||
{variableEditor}
|
||||
{itemPicker}
|
||||
bind:pickForField
|
||||
|
||||
@@ -101,7 +101,13 @@
|
||||
<div class="overflow-y-auto mb-2">
|
||||
<ObjectViewer
|
||||
pureViewer={!$propPickerConfig}
|
||||
json={{ error: 'The error to handle' }}
|
||||
json={{
|
||||
error: {
|
||||
message: 'The error message',
|
||||
name: 'The error name',
|
||||
stack: 'The error stack'
|
||||
}
|
||||
}}
|
||||
on:select
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -87,10 +87,11 @@ import (
|
||||
|
||||
// connect the error parameter to 'previous_result.error'
|
||||
|
||||
func main(error string) (interface{}, error) {
|
||||
fmt.Println(error)
|
||||
fmt.Println("job", os.Getenv("WM_JOB_ID"))
|
||||
return x, nil
|
||||
func main(message string, name string) (interface{}, error) {
|
||||
fmt.Println(message)
|
||||
fmt.Println(name)
|
||||
fmt.Println("flow id that failed", os.Getenv("WM_FLOW_JOB_ID"))
|
||||
return message, nil
|
||||
}
|
||||
`
|
||||
|
||||
@@ -102,13 +103,12 @@ export async function main(x: string) {
|
||||
`
|
||||
|
||||
export const DENO_FAILURE_MODULE_CODE = `
|
||||
// connect the error parameter to 'previous_result.error'
|
||||
|
||||
export async function main(error: string) {
|
||||
const job = Deno.env.get("WM_JOB_ID")
|
||||
console.log("error", error)
|
||||
console.log("job", job)
|
||||
return { error, job }
|
||||
export async function main(message: string, name: string) {
|
||||
const flow_id = Deno.env.get("WM_FLOW_JOB_ID")
|
||||
console.log("message", message)
|
||||
console.log("name",name)
|
||||
return { message, flow_id }
|
||||
}
|
||||
`
|
||||
|
||||
@@ -122,11 +122,11 @@ export const PYTHON_FAILURE_MODULE_CODE = `import os
|
||||
|
||||
# connect the error parameter to 'previous_result.error'
|
||||
|
||||
def main(error: str):
|
||||
job = os.environ.get("WM_JOB_ID")
|
||||
print("error", error)
|
||||
print("job", job)
|
||||
return error, job
|
||||
def main(message: str, name: str):
|
||||
flow_id = os.environ.get("WM_FLOW_JOB_ID")
|
||||
print("message", message)
|
||||
print("name", name)
|
||||
return message, flow_id
|
||||
`
|
||||
|
||||
export const POSTGRES_INIT_CODE = `import {
|
||||
|
||||
Reference in New Issue
Block a user