-
-
Notifications
You must be signed in to change notification settings - Fork 101
Fail crawl with fatal message if custom behavior isn't loaded #799
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
Conversation
const newBehaviors = await collectLocalPathBehaviors(filePath, depth + 1); | ||
behaviors.push(...newBehaviors); | ||
} | ||
if (!behaviors && depth === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, does this mean that specifying an empty directory will lead to an error? I think that could be allowed, as long as directory exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will only lead to an error if pointed to a directory with no behaviors in that directory or any of its subdirectories. I think that makes sense? If someone is pointing at a directory or Git repo expecting the therein to get added but no behaviors are found, it's probably an error of some sort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Pointing out Git repo here because we first clone the git repo and then collect behaviors from the cloned repo via this codepath)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, just thinking if maybe should allow having a placeholder directory that things will be added to later.. I guess could always add a sample behavior or something like that..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah if we go that way I'd suggest we do add a sample behavior. Otherwise we might be setting people up for silent errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave it up to your judgment though
Fixes #797
The crawler will now exit with a fatal log message and exit code 17 if:
--customBehavior
cannot be cloned successfully (new)--customBehavior
is not fetched successfully (new)--customBehavior
, or if an error is thrown while attempting to collect files from a nonexistent path (new)Browser.checkScript
validation (existing behavior)Tests have also been added accordingly.