Use of console

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Use of console

delawen
Hi,

I have been noticing that there are more and more console warnings and
errors in GeoNetwork that are hidden to the user. In fact, only on
pure GeoNetwork code we have close to a hundred of this kind of
warnings:

$ rgrep "console." web-ui/src/main/resources/catalog | grep -v "/lib" | wc -l
98

This is not a bad practice itself, but it can be a bad practice if we
use it without any warning to the final user. Sometimes, an error
happens and the final user has no clue what was wrong. Maybe an error
or warning message will not fix the problem, but sometimes some more
information can give some indication to the user. Specially if the
problem is between the chair and the keyboard :)

Please, be careful when you use console.log, console.warn or
console.error and always try to leave some trace on the user
interface.

Let me remind you that we have an alert service that works quite well:

https://github.com/geonetwork/core-geonetwork/blob/develop/web-ui/src/main/resources/catalog/components/common/alert/Alert.js

Just add it as a dependency to your angular service or controller and
use it like this:

gnAlertService.addAlert({
             msg: '$MESSAGE'
             type: '$LEVEL'
           }, $MILISECONDS_TO_BE_SHOWN);

$MILISECONDS_TO_BE_SHOWN is optional.

$LEVEL can be "info", "success", "warning" or "danger".

Have a happy day!
MarĂ­a.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoNetwork-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork