Merge "API: Handle exceptions from ApiBeforeMain hook in a user-friendly manner"