我想了解何时引发验证异常。当我的自定义请求规则方法验证失败时,$e instanceof ValidationException
返回false,其中$e instanceof HttpResponseException
返回true,并且当我在HttpResponseException上返回return $e->getResponse
时,它确实返回了所需的字段,因此在我的自定义请求验证失败时它会特别激发。我注意到在Illuminate \ Foundation \ Exceptions \ Handler类中,render方法的语句为elseif ($e instanceof ValidationException && $e->getResponse())
,但由于HttpResponseException是第一个引发Rules方法验证失败的方法,因此它不会被执行。所以我有点困惑。何时抛出Validation Exception?
2
A
回答
0
ValidationException被抛出的特质ValidatesRequests
看到照亮/基金/确认/ ValidatesRequests.php
相关问题
- 1. 没有抛出Exception?
- 2. Laravel 4.2 save()方法抛出“Error exception exception。”。
- 3. 如何处理抛出的checked exception
- 4. Future何时可以返回未从Future中抛出的Exception?
- 5. 抛出异常,没有“Exception in thread ...”
- 6. 为什么Exception(str())抛出异常?
- 7. 如果声明为抛出Exception?
- 8. 如何抛出一个不会从Exception继承的异常?
- 9. 如何抛出通过反射创建的Exception类的实例?
- 10. Boost regex_replace exception:“...抛出此异常以防止”永恒“匹配...”被抛出
- 11. Spring集成:如何在抛出Exception时使用Splitter Aggregator的“错误网关”
- 12. 播放2.2.2 @Bean事务处理在抛出Exception时没有回滚事务
- 13. 在Java中的setter中抛出Exception是一个好习惯吗?
- 14. Python是否具有抛出新Exception的Java等价物(“text here”)
- 15. StorageDevice.FromId在Windows 10上抛出“Not Implemented Exception”IoT
- 16. 抛出InvalidArgumentException而不是Exception的优点是什么?
- 17. 区分原始System.Exception并抛出新的Exception/ApplicationException?
- 18. .net webbrowser控件在多线程中抛出“EXCEPTION code = ACCESS_VIOLATION”
- 19. 通过Facebook的API上传盖事件抛出Exception
- 20. 为什么CodePro junit测试方法抛出Exception(在Eclipse中)?
- 21. 更新后的DLL导致JNI抛出“Exception c0000005”
- 22. 我应该在throws子句中抛出Exception的子类型吗?
- 23. EXCEPTION:评估“点击”时出错
- 24. 错误时抛出了NativeAcitivity
- 25. C#Exception Listener
- 26. BackgroundTaskCompletedEventArgs.CheckResult何时抛出异常?
- 27. 何时抛出异常?
- 28. DatagramSocket.receive()何时抛出IOException?
- 29. Object.defineProperty()何时抛出错误?
- 30. 何时应抛出IllegalArgumentException?