Is there anyway to abort processing in a before() ...
# fw1
s
Is there anyway to abort processing in a before() method and prevent it from executing item(). I am checking for an error and then I want to just want to go straight to renderdata and do nothing else: setting a return in before() does not seem to prevent it from continuing on to the item() method.
Copy code
rc["response"]["errors"] = 'Sorry, something went wrong';
variables.fw.renderData().type( 'json' ).data( rc.response ).statusCode( 200 ).statusText( "Successful" );
return;
m
abortController() might meet your needs, placed after your render line
s
thank you
w
you can also just
return variables.fw.renderData()...;
m
pretty sure the item() method will still execute if you just
return variables.fw.renderData()...;