| Conditions | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| 1 | 1 | from ..domain import Image |
|
| 13 | 1 | def create(self, template, text, style=None): |
|
| 14 | 1 | image = Image(template, text, style=style) |
|
| 15 | |||
| 16 | 1 | try: |
|
| 17 | 1 | self.image_store.create(image) |
|
| 18 | 1 | except OSError as exception: |
|
| 19 | 1 | if "name too long" in str(exception): |
|
| 20 | 1 | exception = self.exceptions.FilenameTooLong |
|
| 21 | 1 | elif "image file" in str(exception): |
|
| 22 | 1 | exception = self.exceptions.InvalidImageLink |
|
| 23 | 1 | raise exception from None |
|
| 24 | |||
| 25 | 1 | return image |
|
| 26 | |||
| 35 |