fix: [workflow:editor] Gracefully catch case when trying to access an unknown module id

pull/8590/head
Sami Mokaddem 2022-09-14 09:08:13 +02:00
parent 2f939d219b
commit ec7f60eb22
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 3 additions and 3 deletions

View File

@ -723,7 +723,7 @@ class Workflow extends AppModel
* @return array
* @throws ModuleNotFoundException
*/
public function getModuleConfigByType($module_type, $id, $throwException=false): array
public function getModuleConfigByType($module_type, $id, $throwException=false): ?array
{
$this->loadAllWorkflowModules();
$moduleConfig = $this->loaded_modules[$module_type][$id] ?? null;

View File

@ -723,9 +723,9 @@ function loadWorkflow(workflow) {
Object.values(workflow.data).forEach(function (node) {
var module = all_modules_by_id[node.data.id] || all_triggers_by_id[node.data.id]
if (!module) {
console.error('Tried to add node for unknown module ' + node.data.module_data.id + ' (' + node.id + ')')
console.error('Tried to add node for unknown module ' + node.data.id + ' (' + node.id + ')')
var html = window['dotBlock_error']({
error: 'Invalid module id`' + node.data.module_data.id + '` (' + node.id + ')',
error: 'Invalid module id`' + node.data.id + '` (' + node.id + ')',
data: JSON.stringify(node.data.indexed_params, null, 2)
})
editor.addNode(