How to use task_error ? (Writing pretty hooks)

Thomas Lange lange at informatik.uni-koeln.de
Thu Feb 4 12:01:06 CET 2010


>>>>> On Wed, 3 Feb 2010 21:09:31 +0100 (CET), "Thomas Neumann" <blacky+fai at fluffbunny.de> said:

    > Am I allowed to use task_error in self-written hooks?
Yes.

    > If yes: What exactly means e.g. "task_error 801 $RETVAL" ?
>From the source lib/subroutintes:
### BEGIN SUBROUTINE INFO
# Provides-Var:      $task_error
# Required-Var:      $1 $2 $task_error
# Short-Description: save the maximum error code,
# Short-Description: $1 is the error that will be saved unless $2 is zero


This is an example:

ls 
task_error 801 $?

First ls is called. If ls returns a value other than zero, task_error
will save the error code 801. If ls return 0 no error code will be
saved.


    > Is there a list of error codes already in use? 
2
3
312
321
471
472
474
620
701
702
705
710
801


> May I invent new ones?
yes. Just pick one number of your choice.


Here's an overview of error codes in FAI:

normal or info messages:         1xx, 2xx
warnings:                        3xx, 4xx
minor errors:                    5xx, 6xx
errors:                          7xx, 8xx

At the end of each task (somtimes earlier), the error code is send to
the faimond. The faimond-gui has 4 icons for error levels.

The variable $STOP_ON_ERROR (default 700) defines the threshold when
to stop the installation.


    > Background: I'm in the process of polishing up my custom extrbase hook. It
    > would be nice to properly signal 'something went wrong' (like missing
    > requirements, runtime errors etc.)
task_error is excatly what you should use in this case.

-- 
regards Thomas


More information about the linux-fai mailing list