using Error constructor when throw error