traps request errors and raises an standard exception