IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
290 stars 109 forks source link

Inconsistent errors throwing #191

Closed johnd0e closed 5 years ago

johnd0e commented 5 years ago
  1. throw 'string'
  2. throw new Error 'string'
  3. throw {error: 'string'}

Mostly 1st used. 2nd is better, but mobile debug console is able to handle plain strings only.

I suppose we should fix console.

johnd0e commented 5 years ago

I suppose we should fix console.

It's here: https://github.com/IITC-CE/ingress-intel-total-conversion/blob/master/mobile/app/src/main/java/org/exarhteam/iitc_mobile/Log.java

@modos189 Could you look it?

HubertZhang commented 5 years ago

A backup for discussion in telegram

Currently Android's WebView could only pass string message to host application. And these message are actually generated use Object.toString(). Thus throw new CustomError("message") would just give the host application [object Object].

If we want to fetch more information in host application, we have to format that message before throw or just implement the toString() method