Using ಠ_ಠ to Throw Exceptions

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)
        {
            if(File.Exists(path))
            {
                ಠ_ಠ("error: file exists");
            }

            File.Create(path);
        }

F# version

open System.IO

let ಠ_ಠ = failwith

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

    File.Create(path)

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 thoughts on “Using ಠ_ಠ to Throw Exceptions

  1. For ruby 1.9

    # encoding: utf-8

    def ಠ_ಠ message
    raise Exception, message, caller
    end

    ಠ_ಠ “file not found”

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

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

    You can either:

        sal ಠ_ಠ throw

    or:

        function ಠ_ಠ { throw $args }

    In either case:

        ಠ_ಠ "You're wrong"
  3. Works in R:).


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

    Example:

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

  4. This time with feeling:


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

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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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