# Cannot find name 'ErrorHandler'

**URL:** <https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508>\
**Category:** Ionic Framework\
**Created:** [July 23, 2019, 11:37pm UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508 "2019-07-23T23:37:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ab2211](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@ab2211](https://forum.ionicframework.com/u/ab2211)\
**Post date:** [July 23, 2019, 11:37pm UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/1 "2019-07-23T23:37:50Z")

</div>

I have the error message “ERROR in src/app/app.module.ts(20,15): error TS2304: Cannot find name ‘ErrorHandler’.  
[ng] src/app/app.module.ts(20,39): error TS2304: Cannot find name ‘IonicErrorHandler’.” following the docs “build your first app” after inserting " ```  
providers: [  
StatusBar,  
SplashScreen,  
Camera,  
{provide: ErrorHandler, useClass: IonicErrorHandler}  
],

```auto
What can I do?
```

---

<div class="post-metadata">

**Author:** ![KasunGamage](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/kasungamage/32/130937_2.png) [@KasunGamage](https://forum.ionicframework.com/u/KasunGamage)\
**Post date:** [July 24, 2019, 3:31am UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/2 "2019-07-24T03:31:34Z")

</div>

can u show the code of the class IonicErrorHandler and app.module.ts? did you import both the ErrorHandler and IonicErrorHandler class in app.module.ts?

---

<div class="post-metadata">

**Author:** ![ab2211](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@ab2211](https://forum.ionicframework.com/u/ab2211)\
**Post date:** [July 25, 2019, 11:17pm UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/3 "2019-07-25T23:17:21Z")

</div>

I just followed [https://ionicframework.com/docs/angular/your-first-app/](https://ionicframework.com/docs/angular/your-first-app/).

import { NgModule } from ‘@angular/core’;  
import { BrowserModule } from ‘@angular/platform-browser’;  
import { RouteReuseStrategy } from ‘@angular/router’;

import { IonicModule, IonicRouteStrategy } from ‘@ionic/angular’;  
import { SplashScreen } from ‘@ionic-native/splash-screen/ngx’;  
import { StatusBar } from ‘@ionic-native/status-bar/ngx’;

import { AppRoutingModule } from ‘./app-routing.module’;  
import { AppComponent } from ‘./app.component’;  
import { Camera } from ‘@ionic-native/camera/ngx’;  
@NgModule({  
declarations: [AppComponent],  
entryComponents: ,  
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],  
providers: [  
StatusBar,  
SplashScreen,  
Camera,  
{provide: ErrorHandler, useClass: IonicErrorHandler}  
],  
bootstrap: [AppComponent]  
})  
export class AppModule {}

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [July 26, 2019, 4:36am UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/4 "2019-07-26T04:36:30Z")

</div>

There is no such thing as `IonicErrorHandler` in Ionic **v4** which you seem to use, the doc is probably not up-to-date.

If you don’t have particular error handling requirements and as you are starting an app you could just skip the line

```auto
{provide: ErrorHandler, useClass: IonicErrorHandler}

```

for now on.

---

<div class="post-metadata">

**Author:** ![KasunGamage](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/kasungamage/32/130937_2.png) [@KasunGamage](https://forum.ionicframework.com/u/KasunGamage)\
**Post date:** [July 26, 2019, 9:06am UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/5 "2019-07-26T09:06:46Z")

</div>

> [@KasunGamage](#):
>
> IonicErrorHandler

don’t you have a class called IonicErrorHandler? i didn’t see that in the imports. how do u import that in  
this line  
{provide: ErrorHandler, useClass: IonicErrorHandler}

---

<div class="post-metadata">

**Author:** ![KasunGamage](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/kasungamage/32/130937_2.png) [@KasunGamage](https://forum.ionicframework.com/u/KasunGamage)\
**Post date:** [July 26, 2019, 9:11am UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/6 "2019-07-26T09:11:18Z")

</div>

refer this [https://www.nextfaze.com/blog/production-error-handling-in-ionic/](https://www.nextfaze.com/blog/production-error-handling-in-ionic/) if u using ionic 3.

---

<div class="post-metadata">

**Author:** ![ab2211](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@ab2211](https://forum.ionicframework.com/u/ab2211)\
**Post date:** [July 27, 2019, 2:08pm UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/7 "2019-07-27T14:08:00Z")

</div>

Ok, that helped! I use Ionic 5.2.3.

---

<div class="post-metadata">

**Author:** ![ab2211](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@ab2211](https://forum.ionicframework.com/u/ab2211)\
**Post date:** [July 31, 2019, 11:11pm UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/8 "2019-07-31T23:11:20Z")

</div>

In the same docs I should

"Finally, add the “takePicture” method, already wired up to execute once the camera button has been tapped:

takePicture() {  
const options: CameraOptions = {  
quality: 100,  
destinationType: this.camera.DestinationType.DATA\_URL,  
encodingType: this.camera.EncodingType.JPEG,  
mediaType: this.camera.MediaType.PICTURE  
}

```
this.camera.getPicture(options).then((imageData) => {
  this.currentImage = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
 // Handle error
 console.log("Camera issue:" + err);
});

```

}"  
But in which file?

---

<div class="post-metadata">

**Author:** ![KasunGamage](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/kasungamage/32/130937_2.png) [@KasunGamage](https://forum.ionicframework.com/u/KasunGamage)\
**Post date:** [August 19, 2019, 4:51am UTC](https://forum.ionicframework.com/t/cannot-find-name-errorhandler/169508/9 "2019-08-19T04:51:09Z")

</div>

what do you mean by which file?
