Added location info and custom messages to exception handling.