Skip to content

Commit 77b42a5

Browse files
committed
ExceptionNoEmptyParticle replaces Exception("No empty particle")
1 parent dba0886 commit 77b42a5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cocos/particle.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
from cocosnode import CocosNode
4646
from euclid import Point2
4747

48+
class ExceptionNoEmptyParticle(Exception):
49+
"""particle system have no room for another particle"""
50+
pass
51+
4852
rand = lambda: random.random() * 2 - 1
4953

5054
# PointerToNumpy by Gary Herron
@@ -267,7 +271,7 @@ def add_particle( self ):
267271
Code calling add_particle must be either:
268272
be sure there is room for the particle
269273
or
270-
be prepared to catch the exception Exception("No empty particle")
274+
be prepared to catch the exception ExceptionNoEmptyParticle
271275
It is acceptable to try: ... except...: pass
272276
"""
273277
self.init_particle()
@@ -336,7 +340,7 @@ def init_particle( self ):
336340
if len(idxs[0]) > 0:
337341
idx = idxs[0][0]
338342
else:
339-
raise Exception("No empty particle")
343+
raise ExceptionNoEmptyParticle()
340344

341345
# position
342346
self.particle_pos[idx][0] = self.pos_var.x * rand()

0 commit comments

Comments
 (0)