nicely handle exceptions when processing scripts, tell the user about them

Let's help the user by saying what's going on.
MS-2855/keylogger-mettle-extension
Brent Cook 2017-12-20 06:42:50 -06:00
parent 05c6079e0d
commit 5ecc45a0d1
1 changed files with 8 additions and 4 deletions

View File

@ -164,13 +164,17 @@ module Scriptable
else else
full_path = self.class.find_script_path(script_name) full_path = self.class.find_script_path(script_name)
# No path found? Weak.
if full_path.nil? if full_path.nil?
print_error("The specified script could not be found: #{script_name}") print_error("The specified script could not be found: #{script_name}")
return true return
end
begin
execute_file(full_path, args)
framework.events.on_session_script_run(self, full_path)
rescue StandardError => e
print_error("Could not execute #{script_name}: #{e.class} #{e}")
end end
framework.events.on_session_script_run(self, full_path)
execute_file(full_path, args)
end end
end end