Coverage for lobster/exceptions.py: 53%

13 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-26 14:55 +0000

1#!/usr/bin/env python3 

2# 

3# LOBSTER - Lightweight Open BMW Software Traceability Evidence Report 

4# Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 

5# 

6# This program is free software: you can redistribute it and/or modify 

7# it under the terms of the GNU Affero General Public License as 

8# published by the Free Software Foundation, either version 3 of the 

9# License, or (at your option) any later version. 

10# 

11# This program is distributed in the hope that it will be useful, but 

12# WITHOUT ANY WARRANTY; without even the implied warranty of 

13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

14# Affero General Public License for more details. 

15# 

16# You should have received a copy of the GNU Affero General Public 

17# License along with this program. If not, see 

18# <https://www.gnu.org/licenses/>. 

19 

20from pprint import pprint 

21 

22 

23class LOBSTER_Exception(Exception): 

24 def __init__(self, message, data=None): 

25 super().__init__() 

26 assert isinstance(message, str) 

27 self.message = message 

28 self.data = data 

29 

30 def dump(self): 

31 print("LOBSTER Error: %s" % self.message) 

32 if self.data: 

33 print("-" * 60) 

34 pprint(self.data) 

35 print("-" * 60)