---
lang: en
title: 'API docs: cron.cronjob.onerror'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/extensions/cron
permalink: /doc/en/lb4/apidocs.cron.cronjob.onerror.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/cron](./cron.md) &gt; [CronJob](./cron.cronjob.md) &gt; [onError](./cron.cronjob.onerror.md)

## CronJob.onError() method

<b>Signature:</b>

```typescript
onError(listener: (err: unknown) => void): void;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  listener | (err: unknown) =&gt; void |  |

<b>Returns:</b>

void


