---
schema_version: "1"
id: fa78c0b9299e3488c2acc9cf25d204b7e5dd8ec5a46e0c3bd6dd4c4fdb594f00
title: Presenting User Error Messages
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/canvas-framework/guides/platform-connect/using/lifecycle/canvas-presenting-user-error-messages.md
canonical_url: https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-presenting-user-error-messages.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: bc7580a7a7f3dd6455383f074deddeb7332297ac1b76c8d44ae9d8ce2e304a36
products:
  - Canvas Developer Guide
  - Platform Developer Content
---

# Presenting User Error Messages

You can use Canvas.CanvasRenderException to display error messages to the user.

If you throw a CanvasRenderException from your `onRender()` implementation, the error message in that exception will be displayed to the user in the Salesforce UI. This exception will be managed only within the `onRender()` method.

CanvasRenderException supports all the standard Apex exception class methods and constructors. See ”Exception Class and Build-In Exceptions” in the [Apex Code Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_chapter.htm) for more information on Apex exceptions.

Here’s an example `onRender()` implementation that throws a Canvas.CanvasRenderException. Salesforce uses this exception and displays “Error: Could not set URL” as the user error message.

<!-- otherprops: set_clipboard -->

```apex
public void onRender(Canvas.RenderContext renderContext) {
    // Code omitted that determines if the error condition occured
    ...
    throw new Canvas.CanvasRenderException('Error: Could not set URL.');
}

```

If the canvas app is run from the Salesforce Chatter tab, the error message resembles:

![Screenshot of Salesforce Chatter tab with custom canvas app error](https://developer.salesforce.com/media/canvas-framework/lifecycle_canvasrenderexception_error.png)
