# Handling Errors in Perspective

**URL:** <https://forum.inductiveautomation.com/t/handling-errors-in-perspective/45671>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [April 16, 2021, 3:07am UTC](https://forum.inductiveautomation.com/t/handling-errors-in-perspective/45671 "2021-04-16T03:07:01Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Alex\_SHARIKOV](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Alex\_SHARIKOV](https://forum.inductiveautomation.com/u/Alex_SHARIKOV)\
**Post date:** [January 7, 2023, 9:57am UTC](https://forum.inductiveautomation.com/t/handling-errors-in-perspective/45671/4 "2023-01-07T09:57:23Z")

</div>

Hi [cmallonee](https://forum.inductiveautomation.com/u/cmallonee), I'm doing as suggested. To the popup window I'm passing the traceback.

On a View component

```python
def runAction(self, event):
	try:
		_.update_db_with_error()
	except:
		_.error(self)

```

Script module

```python
def error(_self):
	if _self.session.props.device.type == 'designer':
		raise
	
	params = {'message': traceback.format_exc()}
	system.perspective.openPopup(
		'random_id',
		'Popup/ErrorMessage',
		params=params,
		title='EXECUTION ERROR: contact developers',
		modal=True
	)

```

I noticed that if I'm NOT using `try/catch` on the View component I'm getting native error window with full traceback which includes the cause (which is sooo good) of the exception, like this

```plaintext
caused by SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`mes`.`product_code_line`, CONS.....

```

But when I'm using `try/catch` with `traceback.format_exc()` it cuts the trace and last message is

```plaintext
line 122, in update_db Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(DELETE FROM product_code WHERE id = ?, [25], db_con, , false, false)

```

Is there the way to capture full exception trace by `traceback.format_exc()` as same as the native error window?

---

_[View the full topic](https://forum.inductiveautomation.com/t/handling-errors-in-perspective/45671)._
