الصنف SecurityError في روبي

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

يُطلق الاستثناء SecurityError عند محاولة تنفيذ عملية قد تكون غير آمنة؛ عادةً، يطلق عندما يُرفع مستوى ‎$SAFE  فوق 0:

foo = "bar"
proc = Proc.new do
  $SAFE = 3
  foo.untaint
end
proc.call

سيطلق الاستثناء SecurityError بالشكل التالي عند تنفيذ هذه الشيفرة:

SecurityError: Insecure: Insecure operation `untaint' at level 3

مصادر