Commit Graph

45 Commits

Author SHA1 Message Date
wmayer
5610c22cbb Base: modernize C++: use equals default 2023-08-20 18:10:17 +02:00
wmayer
31ed14db83 modernize C++: use noexcept 2023-08-07 16:06:58 +02:00
wmayer
4e42ff7baa Base: modernize C++: replace 'typedef' with 'using' 2022-08-29 11:42:09 +02:00
wmayer
94c3c481bd Base: [skip ci] fix -Winconsistent-missing-override 2022-08-02 12:43:54 +02:00
berniev
15419982d4 Base: Modernise ctors dtors defs etc 2022-08-02 12:37:46 +02:00
wmayer
a90a39a4c9 Base: add more custom Python exception types 2022-03-17 11:29:09 +01:00
Uwe
581a66aa2d [Base] Exception and FileInfo: remove unused includes 2022-02-23 19:13:13 +01:00
wmayer
659a55ffb9 Base: Exception handling:
* Harmonize FreeCAD with Python exception types
* Implement AbortException::getPyExceptionType() to avoid handling it in client code
* Remove catch block for plain C strings
2022-01-19 18:00:04 +01:00
Heewa Barfchin
ce678a2d4d Fix lost filename in err msg
In some circumstances, FileExceptions are constructed empty, then have a
filename assigned to them, but the error message in these scenarios is
left as the default "unknown" one, which is sometimes shown to users.
This change fixes that case to be consistent with instances that are
constructed with the filename.
2021-05-14 12:34:20 -04:00
luz paz
01b21e0d06 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
wmayer
9367e73e92 LGTM: [skip ci] fix: Inconsistent definition of copy constructor and assignment ('Rule of Two')
Remove user-defined copy constructor of Exception classes without assignment operator
2020-07-27 13:47:41 +02:00
wmayer
5bfef75696 Base: [skip ci] add method to more easily set the Python error indicator from a Base::Exception 2020-03-18 17:53:13 +01:00
luz.paz
011e5aedfa src/Base: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Base` files
2019-12-25 11:38:58 +01:00
luz.paz
fb32601746 Fix various (doxy) typos and whitespace issues
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml`
2019-10-03 07:57:13 +02:00
wmayer
99287c3ebf fix -Winconsistent-missing-override 2019-08-17 19:51:33 +02:00
Zheng, Lei
8f16147a40 Base: improve exception
For better FC and Python exception mapping.
2019-08-17 14:52:08 +02:00
luz.paz
105a9d5ee6 Crowdin: Base/Exception.h uniformity fix 2019-01-30 11:08:03 -02:00
wmayer
1647eee92c add specialized exception type for bad graphs 2018-11-26 14:15:19 +01:00
wmayer
a41a130704 some additions to pR 1794:
add a special XMLAttributeError class to indicate an error when accessing a missing attribute
in PropertyContainer::Restore make error handling more flexible
2018-11-19 19:07:56 +01:00
Abdullah Tahiri
83bee99cde New Base::Exception type RestoreError 2018-11-19 11:31:07 +01:00
wmayer
9b41132580 Replace Base::Exception with appropriate subclass 2018-11-14 23:17:42 +01:00
luz.paz
92e9659fba Misc. comment typos
+ Found via `codespell -q 3 --skip="*.po,*.ts,./.git,./src/3rdParty,./src/CXX,./src/zipios++,./src/Mod/Assembly/App/opendcm" -I ~/Projects/fc-word-whitelist.txt`

+ crowdin translation refinements:  
- https://crowdin.com/translate/freecad/6766/en-en#6499546
- https://crowdin.com/translate/freecad/6766/en-en#6504496
2018-06-13 20:37:17 -04:00
wmayer
ffac6242fd fixes of PR 765
remove QT_TRANSLATE_NOOP because of compiler warnings
mark _isReported as mutable to avoid removing const keyword from ReportException()
improve whitespaces
2017-08-17 22:50:01 +02:00
Abdullah Tahiri
806e06a35e Exception extension to only report once 2017-08-17 22:45:40 +02:00
Abdullah Tahiri
fa3a4f1f4c Exceptions: translation support 2017-08-17 22:44:11 +02:00
luzpaz
9bc7518046 fix typo 2017-07-10 19:29:55 -03:00
wmayer
1d8206acbf Fix various issues:
+ fix dangling pointers when fetching Python error text
+ initialize members in overloaded constructors of Exception class
+ implement assignment operator in sub-class
+ move to PyCXX API to simplify handling with reference counting and reading values from the dict
2017-05-15 18:49:09 +02:00
wmayer
f46e89a1ae fix -Woverloaded-virtual 2017-05-13 16:46:49 +02:00
Abdullah Tahiri
f4c0f0acae Renaming getPyDict to getPyObject for consistency with BaseClass 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
3a27e2d8ff Enable exceptions to save/restore information in a python dictionary and enable throwing exception from dictionary information 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
8884a73b07 Provide default constructors for all exception types 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
82b9eba525 Exception: Extension to access debug information and change of line to int type 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
12d9140e60 Exception: FUNCSIG instead of PRETTY_FUNCTION for Microsoft compiler 2017-05-05 15:15:49 +02:00
Abdullah Tahiri
5cbeb1002e Base::Exception extension
=========================

1. Enable automatic storing of information (function, file, line) when throwing the exception via macro:

Examples:

THROWM(Exception, "BSpline GeoId is out of bounds.")
THROWM(ValueError, "BSpline GeoId is out of bounds.")

THROW(AbortException)

Output:

a) Python Console (what()):
App.ActiveDocument.Sketch004.modifyBSplineKnotMultiplicity(16,3,0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
Base.FreeCADError: FreeCAD exception thrown (BSpline GeoId is out of bounds.)

b) ReportException (report()):
Exception (Thu Apr 27 19:15:24 2017): BSpline GeoId is out of bounds. in bool Sketcher::SketchObject::modifyBSplineKnotMultiplicity(int, int, int) in src/Mod/Sketcher/App/SketchObject.cpp:4102

2. Extend the basic framework so as to allow more control over the mangling of the message introduced by the user, setting the basis to allow, where needed,
 to preserve the original message while allowing full legacy behaviour.

3. Supporting FileDialog reporting as legacy
2017-05-03 22:08:10 +02:00
Abdullah Tahiri
c2eea67893 Exception: Add CADKernelError exception for specialized OCC exception propagation to App::DocumentObject 2017-05-03 22:08:10 +02:00
wmayer
fb7094bf31 use specialized exception classes 2017-04-28 18:49:11 +02:00
Stefan Tröger
d50f7f1787 basic infrastructure 2016-04-12 18:11:46 +02:00
wmayer
123f182c96 + support of drag'n'drop for custom view provider 2015-11-03 16:21:51 +01:00
wmayer
c114c648fc + use dedicated exception classes for expression and parsing errors 2015-09-27 23:17:33 +02:00
Mateusz Skowroński
05f95c0506 Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
wmayer
cff917b013 + Proper handling of sketch plane parallel to view direction 2014-09-27 15:53:21 +02:00
wmayer
609072f140 + in setPyObject() only use classes derived from Base::Exception 2013-07-05 15:29:04 +02:00
wmayer
3a591b3a94 Improve reporting of Python exceptions 2013-05-04 14:23:53 +02:00
wmayer
41c46bf48b 0000777: Shared libraries call exit 2012-07-05 15:24:28 +02:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00