1.8. fx_error_concept

1.8.1. TITLE

fx_error_concept - fx error concept

1.8.2. SCOPE

This section specify error and error handling. That specifications apply for errors in general programming, not only for specific programming language. In specific programming language, it must implement follow specifications. Examples are write in pseudo code.

1.8.3. CONTEXT

  1. TASK is object can be execute.
  2. WORKER is object which execute tasks.
  3. ERROR is a case when worker can not complete TASK.
  4. INTERNAL_ERROR is ERROR which is causes by programmers.
  5. EXTERNAL_ERROR is ERROR which is causes by non programmers.
  6. ERROR_IDENTITY is information represents for ERROR.
  7. NONE_ERROR is special ERROR_IDENTITY which represents no ERROR occurs.
  8. ERROR_STATE is storage which uses to store ERROR_IDENTITY which occurs.
  9. DISCOVER_ERROR mean find ERROR can be occurs while execute set of TASK.
  10. DEFINE_ERROR mean that create ERROR_IDENTITY correspond with ERROR.
  11. DETECT_ERROR mean that detect TASK will causes ERROR.
  12. RAISE_ERROR mean set ERROR_STATE by specific ERROR_IDENTITY.
  13. CATCH_ERROR mean test ERROR_STATE is set by specific ERROR_IDENTITY.
  14. SOLVE_ERROR mean try other TASK to get target result.
  15. ERROR_HANDLING is: DISCOVER_ERROR, DEFINE_ERROR, DETECT_ERROR, RAISE_ERROR, CATCH_ERROR and SOLVE_ERROR.

1.8.4. CLAUSES

  1. MUST: Provide mechanism to DEFINE_ERROR, DETECT_ERROR, RAISE_ERROR, CATCH_ERROR and SOLVE_ERROR.
  2. MUST: Provide NONE_ERROR.
  3. MUST: Provide a ERROR_STATE for a WORKER.
  4. MUST: Set ERROR_STATE by NONE_ERROR on WORKER starting.
  5. MUST: Define all of EXTERNAL_ERROR.
  6. MUST: INTERNAL_ERROR must be remove.
  7. MUST: EXTERNAL_ERROR should be solve.
  8. MUST: Do RAISE_ERROR if EXTERNAL_ERROR can not be solve.
  9. MUST: Abort process if EXTERNAL_ERROR can not be solve ro do RAISE_ERROR.
  10. MUST NOT: Do ERROR_HANDLING with INTERNAL_ERROR.
  11. MUST NOT: Define ERROR_IDENTITY duplication.

1.8.5. EXAMPLE 01

// target: ERROR

devide 8 by 0.
access to 8th index of array have 7 items.
open not early exist file to read.
write to file cause full of disk storage.
connect to not early exist IP address.
play broken video file.

1.8.6. EXAMPLE 02

// target: INTERNAL_ERROR

array a[8] = [1, 2, 3, 4, 5, 6, 7, 8]
array b[8]

for i in [0, 8]:                        // on i = 8
        b = 2 * a[i]                    // access to 9th item
                                        // but 9th item is not exist
                                        // mean internal error occurs

1.8.7. EXAMPLE 03

// target: EXTERNAL_ERROR

array a[] = allocate 2.10^9 bytes       // if computer have not
                                        // enough 2.10^9 free bytes
                                        // mean external error occurs

1.8.8. EXAMPLE 04

// target: INTERNAL_ERROR must be remove

// back to EXAMPLE 01, change code to:

array a[8] = [1, 2, 3, 4, 5, 6, 7, 8]
array b[8]

for i in [0, 7]:                        // fixed
        b = 2 * a[i]

1.8.9. EXAMPLE 04

// target: EXTERNAL_ERROR should be solve

// back to EXAMPLE 02, change code to:

array a[] = allocate 2.10^9 bytes       // error occurs
if can not allocate for a[]             // then it is detect
        try other way                   // and solve
else
        continue to task                // no error occurs, do normal

1.8.10. EXAMPLE 05

// target: Do ``RAISE_ERROR`` if ``EXTERNAL_ERROR`` can not be solve.

array a[] = allocate 2.10^9 bytes       // error occurs
if can not allocate for a[]             // then it is detect
        set error state by full memory  // and raise
else
        continue to task                // no error occurs, do normal

1.8.11. EXAMPLE 06

MUST: Abort process if EXTERNAL_ERROR can not be solve ro do RAISE_ERROR.

array a[] = allocate 2.10^9 bytes       // error occurs
if can not allocate for a[]             // then it is detect
        abort process                   // but can not solve
                                        // and no parent task
                                        // abort process
else
        continue to task                // no error occurs, do normal

libfx v0.0.0 © Copyright 2018, Kevin Leptons. Created using Sphinx 1.6.5

Last updated 2018/02/20 06:12