Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctx.fail error is ignored #96

Closed
matteo-cristino opened this issue Mar 6, 2024 · 0 comments · Fixed by #97
Closed

ctx.fail error is ignored #96

matteo-cristino opened this issue Mar 6, 2024 · 0 comments · Fixed by #97

Comments

@matteo-cristino
Copy link
Collaborator

Using the following script

Given I send path 'filename' and read verbatim file content and output into 'content'
Given I have a 'string' named 'content'
Then print data

with keys

{
  "filename": {
    "path": "test.txt"
  }
}

The script should return the error path must be string raised at line 100 here:

export const readVerbatimFileContent = p.new(['path'], 'read verbatim file content', async (ctx) => {
const unsafe = ctx.fetch('path');
if (typeof unsafe !== 'string') return ctx.fail('path must be string');
const { filepath, error } = resolveFilepath(unsafe);
if (!filepath) return ctx.fail(error);
return ctx.pass(await readFile(filepath));
});

while it fails only beacuse zenroom can not find the string named content in input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant