diff --git a/dstat-interface/dstat-interface/dstat_comm.py b/dstat-interface/dstat-interface/dstat_comm.py index 645f0af0f77782581adf16e0ddfe6caa100e2805..eed6de64d436b7b57aab52376a870d125bcd9a87 100644 --- a/dstat-interface/dstat-interface/dstat_comm.py +++ b/dstat-interface/dstat-interface/dstat_comm.py @@ -22,6 +22,7 @@ from serial.tools import list_ports import time import struct import multiprocessing as mp +from errors import VarError def call_it(instance, name, args=(), kwargs=None): """Indirect caller for instance methods and multiprocessing. diff --git a/dstat-interface/dstat-interface/errors.py b/dstat-interface/dstat-interface/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..9661262b9a4836198e9f8bcb2781dfee167e3f53 --- /dev/null +++ b/dstat-interface/dstat-interface/errors.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# DStat Interface - An interface for the open hardware DStat potentiostat +# Copyright (C) 2014 Michael D. M. Dryden - +# Wheeler Microfluidics Laboratory <http://microfluidics.utoronto.ca> +# +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +class Error(Exception): + """Copies Exception class""" + pass + +class InputError(Error): + """Exception raised for errors in the input. Extends Error class. + + Attributes: + expr -- input expression in which the error occurred + msg -- error message + """ + + def __init__(self, expr, msg): + self.expr = expr + self.msg = msg + +class VarError(Error): + """Exception raised for internal variable errors. Extends Error class. + + Attributes: + var -- var in which the error occurred + msg -- error message + """ + + def __init__(self, var, msg): + self.var = var + self.msg = msg \ No newline at end of file diff --git a/dstat-interface/dstat-interface/main.py b/dstat-interface/dstat-interface/main.py index 574cf3926a4ff4dc28fc38c31be67e697683069e..4ce8c7a6ca077b7a2270771b1fdaad9fb4431c54 100644 --- a/dstat-interface/dstat-interface/main.py +++ b/dstat-interface/dstat-interface/main.py @@ -44,27 +44,12 @@ import interface.exp_window as exp_window import interface.adc_pot as adc_pot import plot import microdrop +from errors import InputError, VarError from serial import SerialException import multiprocessing import time -class Error(Exception): - """Copies Exception class""" - pass - -class InputError(Error): - """Exception raised for errors in the input. Extends Error class. - - Attributes: - expr -- input expression in which the error occurred - msg -- error message - """ - - def __init__(self, expr, msg): - self.expr = expr - self.msg = msg - class Main(object): """Main program """ def __init__(self):