std_exception.cpp 818 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * file: exception.cpp
  3. * author: Hilton Bristow
  4. * date: Wed, 19 Jun 2013 11:15:15
  5. *
  6. * See LICENCE for full modification and redistribution details.
  7. * Copyright 2013 The OpenCV Foundation
  8. */
  9. #include <exception>
  10. #include "mex.h"
  11. /*
  12. * exception
  13. * Gateway routine
  14. * nlhs - number of return arguments
  15. * plhs - pointers to return arguments
  16. * nrhs - number of input arguments
  17. * prhs - pointers to input arguments
  18. */
  19. void mexFunction(int nlhs, mxArray* plhs[],
  20. int nrhs, const mxArray* prhs[]) {
  21. // call the opencv function
  22. // [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
  23. try {
  24. throw std::exception();
  25. } catch(const std::exception& e) {
  26. mexErrMsgTxt(e.what());
  27. } catch(...) {
  28. mexErrMsgTxt("Incorrect exception caught!");
  29. }
  30. }