refactor error into invocable