present errors when calling steps better

browsersteps-start-refactor
dgtlmoon 2 years ago
parent 98c0220e13
commit 9f56b45bd9

@ -131,21 +131,11 @@ def construct_blueprint(datastore: ChangeDetectionStore):
this_session.call_action(action_name=step_operation,
selector=step_selector,
optional_value=step_optional_value)
except playwright._impl._api_types.TimeoutError as e:
print("Element wasnt found :-(", step_operation)
return make_response("Element was not found on page", 401)
except playwright._impl._api_types.Error as e:
# Browser/playwright level error
print("Browser error - got playwright._impl._api_types.Error, try reloading the session/browser")
print (str(e))
except Exception as e:
print("Exception when calling step operation", step_operation, str(e))
# Try to find something of value to give back to the user
for l in str(e).splitlines():
if 'DOMException' in l:
return make_response(l, 401)
return make_response('Browser session ran out of time :( Please reload this page.', 401)
return make_response(str(e).splitlines()[0], 401)
# Get visual selector ready/update its data (also use the current filter info from the page?)
# When the last 'apply' button was pressed

@ -194,7 +194,6 @@ $(document).ready(function () {
// });
// callback for clicking on an xpath on the canvas
function process_selected(xpath_data_index) {
found_something = false;
@ -414,6 +413,13 @@ $(document).ready(function () {
// More than likely the CSRF token was lost when the server restarted
alert("There was a problem processing the request, please reload the page.");
$("#loading-status-text").hide();
$('#browser-steps-ui .loader .spinner').fadeOut();
},
401: function (data) {
// More than likely the CSRF token was lost when the server restarted
alert(data.responseText);
$("#loading-status-text").hide();
$('#browser-steps-ui .loader .spinner').fadeOut();
}
}
}).done(function (data) {
@ -436,7 +442,6 @@ $(document).ready(function () {
$("#loading-status-text").hide();
$('ul#browser_steps li .control .apply').css('opacity', 1);
$("#browsersteps-img").css('opacity', 1);
//$('#browsersteps-selector-wrapper .loader').fadeOut(2500);
});
});

Loading…
Cancel
Save