# Perspective File Upload - No error catching/reporting for user

**URL:** <https://forum.inductiveautomation.com/t/perspective-file-upload-no-error-catching-reporting-for-user/62188>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [July 22, 2022, 12:50am UTC](https://forum.inductiveautomation.com/t/perspective-file-upload-no-error-catching-reporting-for-user/62188 "2022-07-22T00:50:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Walker](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Ben\_Walker](https://forum.inductiveautomation.com/u/Ben_Walker)\
**Post date:** [July 22, 2022, 12:50am UTC](https://forum.inductiveautomation.com/t/perspective-file-upload-no-error-catching-reporting-for-user/62188/1 "2022-07-22T00:50:14Z")

</div>

Hey, I’m on Edge (8.1.18) and I’m using the File Upload control in Perspective in a Workstation Kiosk environment.

I noticed that if I simulate an error on the **onFileReceived** **event.file.copyTo()** method, such as a broken file path or permission denied, I cannot capture the exception with a try block. Instead, it is only captured by the Gateway since apparently this exception isn’t raised to the calling function. Also, which is slightly more concerning, the control reports that the upload was a success, despite it failing to copy the file.

I have some workarounds, but I was wondering if I am missing anything here, and if not, I’d like to request that in a future release the control raises the exception to the caller.

Thanks!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 22, 2022, 12:57am UTC](https://forum.inductiveautomation.com/t/perspective-file-upload-no-error-catching-reporting-for-user/62188/2 "2022-07-22T00:57:51Z")

</div>

Two considerations:

1. Java exceptions and python exceptions behave differently. To reliably capture both, you need two `except:` clauses.

2. All scripts in Perspective run on the gateway, so will always report exceptions to the gateway log. Production websites do the same–exceptions showing in the browser are a security leak.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 22, 2022, 3:11am UTC](https://forum.inductiveautomation.com/t/perspective-file-upload-no-error-catching-reporting-for-user/62188/3 "2022-07-22T03:11:20Z")

</div>

To also expand a little bit, the component is reporting success on receiving the file and entering the onFileReceived Event. Problems within the onFileReceived Event do not play into what the component reports; errors/exceptions encountered there must be conveyed by some other UI put in place by the Designer of the project.

---

<div class="post-metadata">

**Author:** ![Ben\_Walker](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Ben\_Walker](https://forum.inductiveautomation.com/u/Ben_Walker)\
**Post date:** [July 22, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/perspective-file-upload-no-error-catching-reporting-for-user/62188/4 "2022-07-22T16:37:41Z")

</div>

Thanks, pturmel. Your 1st point was the solution. For the benefit of other viewers of this topic, to capture the Java exceptions raised by the controls, you’ll need to import **java** and use an **except** statement:

```auto
import java
	
try:
	# code here
	
except java.lang.Exception as err:
	# handle error

```
