add error handling, exposing exceptions in resource code