Error Handling¶
boogr ¶
Assembly: Fonky
Filename: boogr.py
Author: Terry D. Eppler
Created: 05-31-2022
Last Modified By: Terry D. Eppler
Last Modified On: 05-01-2026
boogr.py
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You can contact me at: terryeppler@gmail.com or eppler.terry@epa.gov
Error ¶
Bases: Exception
Wrap an exception with application-specific diagnostic metadata.
Purpose
Captures the original exception, traceback text, optional heading, cause, module name, and method signature used by Fonky exception handlers. The wrapper provides a stable object that can be raised by calling code and written by the Logger without requiring each caller to format traceback details manually.
Attributes:
| Name | Type | Description |
|---|---|---|
exception |
Exception
|
Original exception instance being wrapped. |
heading |
str | None
|
Optional display heading associated with the error. |
cause |
str | None
|
Logical component or class responsible for the failure. |
method |
str | None
|
Stable method or function signature where the failure occurred. |
module |
str | None
|
Source module where the failure occurred. |
type |
type | None
|
Active exception type reported by |
trace |
str
|
Formatted traceback text captured at wrapper construction time. |
info |
str
|
Combined exception type and formatted traceback text. |
Source code in boogr.py
Logger ¶
Persist wrapped exception details to the configured SQLite logging database.
Purpose
Provides a small application logger that writes Error metadata to the SQLite database
identified by config.LOG_PATH and the table identified by config.LOG_FILE. The
class creates the logging directory and table as needed, then records exception cause,
module, method, message, diagnostic information, traceback text, and creation time.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
Filesystem path to the SQLite logging database. |
table |
str
|
SQLite table name used for persisted exception records. |
query |
str | None
|
SQL statement prepared for the active logging operation. |
values |
tuple[Any, ...] | None
|
Values prepared for the active logging operation. |
Source code in boogr.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
create_table ¶
Create the exception table when it does not already exist.
Purpose
Ensures the logging directory and SQLite exception table exist before an exception record is written. The schema stores stable diagnostic fields used by Fonky modules and avoids raising setup failures back into application exception handlers.
Source code in boogr.py
write ¶
Write an error record to the logging database.
Purpose
Persists a wrapped Error object to the configured SQLite database using the standard Fonky exception schema. Logging is intentionally failure-safe: a database or filesystem failure during logging is suppressed so it does not mask the original application error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
Error
|
Wrapped exception object containing diagnostic metadata to persist. |
required |