Skip to content

Commit 229b55a

Browse files
df7cbmsdemlei
authored andcommitted
Catch PlanckError
This is thrown by the C++ healpix lib when a polygon is not convex.
1 parent 1ed597a commit 229b55a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

expected/moc.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,3 +748,6 @@ SELECT smoc(6, p) FROM g;
748748
5/4522 6/
749749
(1 row)
750750

751+
-- lswscans/data/part1/Bruceplatten/FITS/B3558b.fits
752+
SELECT smoc(6, '{(1.28867804735846 , 0.421769766439468),(1.40564002826964 , 0.201070262502835),(1.27597340819331 , 0.210561432516079),(1.28707379974056 , 0.351693515652388)}'::spoly);
753+
ERROR: MOC processing error: polygon is not convex

process_moc.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <sstream>
1313
#include <exception>
1414
#include <stdexcept>
15+
#include <cxxabi.h> /* __cxa_current_exception_type */
1516

1617
#include <healpix_base.h>
1718

@@ -37,10 +38,15 @@
3738
delete p; \
3839
error_out(e.what(), 0); \
3940
} \
41+
catch (PlanckError & e) \
42+
{ \
43+
delete p; \
44+
error_out(e.what(), 0); \
45+
} \
4046
catch (...) \
4147
{ \
4248
delete p; \
43-
error_out("unknown exception", 0); \
49+
error_out(__cxxabiv1::__cxa_current_exception_type()->name(), 0); \
4450
}
4551

4652
using std::size_t;

sql/moc.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,6 @@ SELECT smoc(3, '{(.1,.1), (.1,-1), (-1,-1), (-1, .1)}'::spoly);
165165
CREATE TABLE g (p spoly);
166166
INSERT INTO g (p) VALUES (spoly '{(1.48062434277764d , -0.112757492761271d),(1.48062583213677d , -0.0763898467955446d),(1.44427278313068d, -0.0762453395638312d),(1.44413625055362d , -0.112726631135703d)}');
167167
SELECT smoc(6, p) FROM g;
168+
169+
-- lswscans/data/part1/Bruceplatten/FITS/B3558b.fits
170+
SELECT smoc(6, '{(1.28867804735846 , 0.421769766439468),(1.40564002826964 , 0.201070262502835),(1.27597340819331 , 0.210561432516079),(1.28707379974056 , 0.351693515652388)}'::spoly);

0 commit comments

Comments
 (0)