1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3 4# 5# Copyright 2017, Data61 6# Commonwealth Scientific and Industrial Research Organisation (CSIRO) 7# ABN 41 687 119 230. 8# 9# This software may be distributed and modified according to the terms of 10# the BSD 2-Clause license. Note that NO WARRANTY is provided. 11# See "LICENSE_BSD2.txt" for details. 12# 13# @TAG(DATA61_BSD) 14# 15 16from __future__ import absolute_import, division, print_function, \ 17 unicode_literals 18from camkes.internal.seven import cmp, filter, map, zip 19 20from camkes.internal.exception import CAmkESError 21import six 22 23class TemplateError(CAmkESError): 24 def __init__(self, content, entity=None): 25 assert isinstance(content, six.string_types) 26 if hasattr(entity, 'location') and entity.location is not None: 27 msg = self._format_message(content, entity.location.filename, 28 entity.location.lineno, entity.location.min_col, 29 entity.location.max_col) 30 else: 31 msg = self._format_message(content) 32 super(TemplateError, self).__init__(msg) 33