implemented custom exception in scala