error: Add 'sub-type' field to '&netlink-decoder-error' and use it. * netlink/error.scm (&netlink-decoder-error)[sub-type]: New field. * netlink/data.scm (get-next-deserialize, get-current-deserialize): Fill it out. Signed-off-by: Julien Lepiller <julien@lepiller.eu>
netlink/data.scm
| 51 | 51 | (match (assoc-ref decoder current-type) | |
| 52 | 52 | ((_ . type-alist) | |
| 53 | 53 | (or (assoc-ref type-alist target-type) | |
| 54 | - | (assoc-ref type-alist 'default))) | |
| 54 | + | (assoc-ref type-alist 'default) | |
| 55 | + | (raise (condition (&netlink-decoder-error | |
| 56 | + | (type current-type) | |
| 57 | + | (sub-type target-type)))))) | |
| 55 | 58 | (#f (raise (condition (&netlink-decoder-error | |
| 56 | - | (type current-type))))))) | |
| 57 | - | ||
| 59 | + | (type current-type) | |
| 60 | + | (sub-type target-type))))))) | |
| 61 | + | ||
| 58 | 62 | (define (get-current-deserialize decoder current-type) | |
| 59 | 63 | (match (assoc-ref decoder current-type) | |
| 60 | 64 | ((current-deserialize . _) current-deserialize) | |
| 61 | 65 | (#f (raise (condition (&netlink-decoder-error | |
| 62 | - | (type current-type))))))) | |
| 66 | + | (type current-type) | |
| 67 | + | (sub-type #f))))))) | |
| 63 | 68 | ||
| 64 | 69 | (define (deserialize type decoder bv pos) | |
| 65 | 70 | (let ((deserialize (get-current-deserialize decoder type))) |
netlink/error.scm
| 23 | 23 | &netlink-decoder-error | |
| 24 | 24 | netlink-decoder-error? | |
| 25 | 25 | netlink-decoder-error-type | |
| 26 | + | netlink-decoder-error-sub-type | |
| 26 | 27 | ||
| 27 | 28 | &netlink-family-error | |
| 28 | 29 | netlink-family-error? | |
… | |||
| 57 | 58 | ;; No decoder for type | |
| 58 | 59 | (define-condition-type &netlink-decoder-error &netlink-error | |
| 59 | 60 | netlink-decoder-error? | |
| 60 | - | (type netlink-decoder-error-type)) | |
| 61 | + | (type netlink-decoder-error-type) | |
| 62 | + | (sub-type netlink-decoder-error-sub-type)) | |
| 61 | 63 | ||
| 62 | 64 | ;; Unknown protocol family | |
| 63 | 65 | (define-condition-type &netlink-family-error &netlink-error | |