Question: I have to create one service that will log any run-time error occurred in the application.

I have created a service named "ErrorHandlingService" and below given code is written

```
 import { ErrorHandler } from '@angular/core';
 export class ErrorhandlingService implements ErrorHandler {
     handleError(error: any): void {
         console.error('Some error occured: ', error);
     }
 }

```

In app.module.ts I have written the below code

```
 @NgModule({
     declarations: [AppComponent],
     entryComponents: [],
     providers: [StatusBar, SplashScreen,
         { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
         { provide: ErrorHandler, useClass: ErrorhandlingService },
     bootstrap: [AppComponent],
 })

```

But still the default error is shown

Answer: 
You have used `this.getData`, it should be `this.getData()`
and you have to use an arrow function.

Try this:

```
setInterval(() => this.getData(), 10000);

```
Use of arrow function is a great response but you should be careful when using `setInterval`. 
You should definitely prefer usage of RxJS in an Angular application context : 

```
interval(10000).pipe(
   mergeMap(() => this.getData())
).subscribe()

```

Bad practices usage of setInterval : <https://dev.to/akanksha_9560/why-not-to-use-setinterval--2na9>