1.1 --- a/moinconvert Fri Mar 15 18:37:04 2019 +0100
1.2 +++ b/moinconvert Tue Apr 09 16:03:59 2019 +0200
1.3 @@ -19,7 +19,8 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from moinformat import make_parser, make_serialiser, Metadata, parse, serialise
1.8 +from moinformat import errors, make_parser, make_serialiser, Metadata, parse, \
1.9 + serialise
1.10 from os.path import split
1.11 import sys
1.12
1.13 @@ -379,6 +380,9 @@
1.14 """
1.15
1.16 if __name__ == "__main__":
1.17 - main()
1.18 + try:
1.19 + main()
1.20 + except errors.ProcessingError, exc:
1.21 + print str(exc)
1.22
1.23 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/moinformat/__init__.py Fri Mar 15 18:37:04 2019 +0100
2.2 +++ b/moinformat/__init__.py Tue Apr 09 16:03:59 2019 +0200
2.3 @@ -3,7 +3,7 @@
2.4 """
2.5 Moin wiki format tools.
2.6
2.7 -Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2017, 2018, 2019 Paul Boddie <paul@boddie.org.uk>
2.9
2.10 This program is free software; you can redistribute it and/or modify it under
2.11 the terms of the GNU General Public License as published by the Free Software
2.12 @@ -26,5 +26,6 @@
2.13 from moinformat.parsers import get_parser, make_parser, parse
2.14 from moinformat.serialisers import get_serialiser, make_serialiser, serialise
2.15 from moinformat.themes import make_theme
2.16 +import moinformat.errors as errors
2.17
2.18 # vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/moinformat/errors.py Tue Apr 09 16:03:59 2019 +0200
3.3 @@ -0,0 +1,35 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +"""
3.7 +Moin wiki processing errors.
3.8 +
3.9 +Copyright (C) 2019 Paul Boddie <paul@boddie.org.uk>
3.10 +
3.11 +This program is free software; you can redistribute it and/or modify it under
3.12 +the terms of the GNU General Public License as published by the Free Software
3.13 +Foundation; either version 3 of the License, or (at your option) any later
3.14 +version.
3.15 +
3.16 +This program is distributed in the hope that it will be useful, but WITHOUT
3.17 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
3.18 +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
3.19 +details.
3.20 +
3.21 +You should have received a copy of the GNU General Public License along with
3.22 +this program. If not, see <http://www.gnu.org/licenses/>.
3.23 +"""
3.24 +
3.25 +class ProcessingError(Exception):
3.26 +
3.27 + "A generic processing error."
3.28 +
3.29 + def __init__(self, errors):
3.30 + self.errors = errors
3.31 +
3.32 + def __repr__(self):
3.33 + return "%s(%r)" % (self.__class__.__name__, self.errors)
3.34 +
3.35 + def __str__(self):
3.36 + return "Error: %s\nMessage: %s\n" % (self.__class__.__name__, self.errors)
3.37 +
3.38 +# vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/moinformat/serialisers/html/graphviz.py Fri Mar 15 18:37:04 2019 +0100
4.2 +++ b/moinformat/serialisers/html/graphviz.py Tue Apr 09 16:03:59 2019 +0200
4.3 @@ -20,7 +20,7 @@
4.4 """
4.5
4.6 from moinformat.serialisers.common import Serialiser, escape_attr, escape_text
4.7 -from moinformat.utils.graphviz import Graphviz, GraphvizError, IMAGE_FORMATS, \
4.8 +from moinformat.utils.graphviz import Graphviz, IMAGE_FORMATS, \
4.9 get_output_identifier
4.10
4.11 # Utility functions.
5.1 --- a/moinformat/utils/graphviz.py Fri Mar 15 18:37:04 2019 +0100
5.2 +++ b/moinformat/utils/graphviz.py Tue Apr 09 16:03:59 2019 +0200
5.3 @@ -3,7 +3,7 @@
5.4 """
5.5 Graphviz utilities.
5.6
5.7 -Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
5.8 +Copyright (C) 2018, 2019 Paul Boddie <paul@boddie.org.uk>
5.9
5.10 This program is free software; you can redistribute it and/or modify it under
5.11 the terms of the GNU General Public License as published by the Free Software
5.12 @@ -19,6 +19,7 @@
5.13 this program. If not, see <http://www.gnu.org/licenses/>.
5.14 """
5.15
5.16 +from moinformat.errors import ProcessingError
5.17 from os.path import exists, join
5.18 from StringIO import StringIO
5.19 from subprocess import Popen, PIPE
5.20 @@ -184,12 +185,11 @@
5.21
5.22 # Classes for interacting with Graphviz.
5.23
5.24 -class GraphvizError(Exception):
5.25 +class GraphvizError(ProcessingError):
5.26
5.27 "An error produced when using Graphviz."
5.28
5.29 - def __init__(self, errors):
5.30 - self.errors = errors
5.31 + pass
5.32
5.33 class Graphviz:
5.34