Andy Kutruff


Using ಠ_ಠ to Throw Exceptions

Posted by Andy Kutruff on February 8, 2011

Most people don’t know that you can oftentimes put Unicode characters in your code. However, the look of disapproval is gold, and I am now going to use it to throw exceptions.

C# version:

        public static void ಠ_ಠ(string error)
            throw new Exception(error);

        public static void CreateFile(string path)
                ಠ_ಠ("error: file exists");


F# version

open System.IO

let ಠ_ಠ = failwith

let createFile path =
    if File.Exists(path) then
        ಠ_ಠ "error: file exists"


Note: This is inspired from a practical joke from some coworkers in the past. Someone apparently snuck in a method named _μ into the code. That is “underscore mu” and apparently it drove people nuts.

19 Responses to “Using ಠ_ಠ to Throw Exceptions”

  1. Trevor said

    This works in Python 3.0+ as well:

    #!/usr/bin/env python3.2
    # coding=utf-8

    def ಠ_ಠ(err):
    raise Exception(err)

    ಠ_ಠ("herp derp")

  2. hawth said

    For ruby 1.9

    # encoding: utf-8

    def ಠ_ಠ message
    raise Exception, message, caller

    ಠ_ಠ “file not found”

    look_of_dissaproval.rb:7:in `’: file not found (Exception)

  3. […] This post was mentioned on Twitter by Carlos Benítez, Jimmy L., Jeremy Mikola, Jeremy Mikola, Tech news (BOT) and others. Tech news (BOT) said: Reddit/p: Using ಠ_ಠ to Throw Exceptions […]

  4. TJ GIllis said

    Works in as3

    private function ಠ_ಠ():void{}

  5. luben said

    use utf8;
    sub ಠ_ಠ { die @_ }
    ಠ_ಠ(“I’m sad”)

  6. Matt said

    Works in PHP 5.3:

    function ಠ_ಠ ($foo) {
    	echo("foo + 1 == " . ($foo + 1) . "\n");
    ಠ_ಠ (5);
  7. Scott said

    function ಠ_ಠ(err) {


  8. jaykul said

    Works in PowerShell, if you’re using a unicode-capable host like PowerShell ISE or PoshConsole

    You can either:

        sal ಠ_ಠ throw


        function ಠ_ಠ { throw $args }

    In either case:

        ಠ_ಠ "You're wrong"
  9. jaykul said

    That should read:

    Set-Alias ಠ_ಠ Write-Error

    You can’t set an alias for throw in PowerShell.

  10. Mastur B. said

    It is more satisfying to embed SHIFT-JIS encoded strings into class names.

  11. Simon said

    Works in R :).

    >ಠ_ಠ <- function(x) { stop(as.character(x)) }


    > sapply(1:5, function(x) { if (x == 5) ಠ_ಠ(x) })
    Error in ಠ_ಠ(x) : 5

  12. Bob said

    getMessage() . ” It won’t happen again\n”;


  13. Bob said

    This time with feeling:

    function ಠ_ಠ($error)
    throw new Exception($error);

    ಠ_ಠ("I'm so sorry.");
    catch (Exception $e)
    echo $e->getMessage() . " It won't happen again\n";

  14. Henrik N said

    Ruby 1.8:

    #!ruby -Ku
    module Kernel
      alias_method :ಠ_ಠ, :raise
    ಠ_ಠ "fail"

  15. gogo said

    Golang version:

    func ಠ_ಠ(s string){

  16. Casey said

    Thanks for this, made my day! :D

  17. JavaScript version:

    function ಠ_ಠ( error ) {
        throw( error );
    try {
        ಠ_ಠ( 'Oops!' );
    catch( error ) {
        alert( error );
  18. hemanth said

    function ಠ_ಠ
    echo “Bomb!”

    Works in BASH :)

  19. Buvinghausen said

    Decided to make a jQuery script based on this

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: