what_error 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +46 -0
  4. data/lib/what_error.rb +71 -0
  5. metadata +50 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b906dc51c1b93b110e292014692a6748f2f88929057ace50399686d02bac84b9
4
+ data.tar.gz: 0aa2bbb6a319c84cda32d4b77facf6138475c2b64d41de07a00931a20fdf9f3b
5
+ SHA512:
6
+ metadata.gz: 51cba1d0be1407a1392164a324ed4c16ec35895af05181e87bbfdb2f96e9546171452802b577860c5ab5af46ececfaee6bf23ab8534954e46d6b45ad8620f398
7
+ data.tar.gz: 0c91dad152c45c652f7ef68a65527f8f07c978563883e28b37f160381f9d9d8833305189055c8ebb939bd1481e0a55dd7413f98c5f08cfe2fb80183cc1ef3fbe
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 tacocat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # WhatError
2
+
3
+ > **🚨 WARNING: This gem is for PRANKS and ENTERTAINMENT only!**
4
+ > **DO NOT use in production, serious projects, or anywhere it might cause actual distress!**
5
+ > **It is currently EXPERIMENTAL, so some features may NOT work as expected.
6
+ > **Using it with other gems may cause something unexpected.
7
+
8
+ A mischievous Ruby gem that randomly replaces your code errors with exceptions from the StandardError family and generates completely fake, confusing error messages filled with emojis and made-up file paths.
9
+
10
+ ## πŸ“¦ Installation
11
+
12
+ Install the gem with:
13
+
14
+ ```bash
15
+ gem install what_error
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Simply add this to any Ruby file:
21
+
22
+ ```ruby
23
+ require 'what_error'
24
+
25
+ # Your normal code here...
26
+ ```
27
+
28
+ Then run the file:
29
+
30
+ ```bash
31
+ ruby your_file.rb
32
+ ```
33
+
34
+ If an error is rescued, the program will raise an random exception from the StandardErrw family with fake backtrace and boring emojis.
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/what_error. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/what_error/blob/master/CODE_OF_CONDUCT.md).
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
43
+
44
+ ## Code of Conduct
45
+
46
+ Everyone interacting in the WhatError project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/what_error/blob/master/CODE_OF_CONDUCT.md).
data/lib/what_error.rb ADDED
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WhatError
4
+ VERSION = "0.1.0"
5
+ class << self
6
+ def vykurchhtjtcddhtdxhxbfxbttxjyytsgnxtyxxfudutdutdtxx
7
+ # I rolled my face on the keyboard
8
+
9
+ # Why?
10
+ if in_irb? then
11
+ puts "🚫: Sorry, WhatError is disabled in IRB. Please require in actual ruby files. UwU, im so cuuuuuute."
12
+ return
13
+ end
14
+
15
+ @cf = Kernel.caller[-1][/^(.+?):/, 1] or raise ArgumentError, "unknown file"
16
+ @emojis = "πŸ˜„πŸ˜†πŸ˜‚πŸ€£πŸ˜­πŸ€”πŸ˜ŒπŸ₯°πŸ˜πŸ˜˜πŸ€πŸ€‘πŸ˜šπŸ˜œπŸ˜·πŸ˜ πŸ˜πŸ˜‘πŸ˜”πŸ™ƒβ˜ΊοΈπŸ˜«πŸ˜πŸ˜‰πŸ˜¨πŸ˜°πŸ™‚πŸ˜πŸ˜±πŸ˜£πŸ₯ΊπŸ€—πŸ˜–πŸ˜₯πŸ€—πŸ˜’πŸ˜ͺπŸ˜žπŸ˜“πŸ˜©πŸ˜€πŸ˜…πŸ₯΅πŸ€‘πŸ€₯🀭🀫🀀πŸ€ͺ🀯🀩πŸ₯ΆπŸ« πŸ˜΅β€πŸ’«πŸ€’".chars
17
+ @dir = %w[/mnt /usr /home /bin /ruby /etc /shared /var /opt /include]
18
+ @e_classes = ObjectSpace.each_object(Class).select { |c| c < StandardError }
19
+
20
+ code = File.read(@cf).gsub /require "what_error"/, ""
21
+ catch :ev do
22
+ begin
23
+ eval code
24
+ rescue
25
+ throw :ev
26
+ else
27
+ exit 1
28
+ end
29
+ end
30
+
31
+ msg = String.new
32
+ begin
33
+ raise @e_classes.sample
34
+ rescue => e
35
+ msg << main_e(e)
36
+ msg << sub_fake_backtrace(e)
37
+ puts msg
38
+ exit 0
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def main_e(e)
45
+ return "#{@cf}:#{rand(1..10000)}: #{e.message} (\e[1;4m#{e.class}\e[0m)\n"
46
+ end
47
+
48
+ def in_irb?
49
+ defined?(IRB) ||
50
+ $0 == "irb" ||
51
+ (caller.any? { |line| line.include?('irb') }) ||
52
+ (defined?(BindingInspector) && !ENV['TERM_PROGRAM'].nil?)
53
+ end
54
+
55
+ def sub_fake_backtrace(e)
56
+ bt = e.backtrace.map do |b|
57
+ b.gsub(/'.+?'/, @emojis.sample)
58
+ .gsub(/\/.+?:/, "#{fake_dir}/#{@cf}:")
59
+ end
60
+ bt.pop
61
+ return bt.map{|l| l.gsub(/^/, "\tformm ")}.join("\n")
62
+ end
63
+
64
+ def fake_dir
65
+ Array.new(rand(1..8)) { @dir.sample }.join
66
+ end
67
+ end
68
+ end
69
+
70
+ WhatError.vykurchhtjtcddhtdxhxbfxbttxjyytsgnxtyxxfudutdutdtxx
71
+ WhatError.send(:in_irb?)
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: what_error
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tacocat
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-11-15 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: "A mischievous Ruby gem that randomly replaces your code errors with
13
+ exceptions from the StandardError family and generates completely fake, confusing
14
+ error messages filled with emojis and made-up file paths.\n\n\U0001F6A8 WARNING:\nβ€’
15
+ This gem is for PRANKS and APRIL FOOLS' only!\nβ€’ It is currently EXPERIMENTAL, so
16
+ some features may NOT work as expected.\nβ€’ DO NOT use in production, serious projects,
17
+ or anywhere it might cause actual distress.\nβ€’ Using it with other gems may cause
18
+ something unexpected.\n\nFeatures:\nβ€’ Random success/failure decisions\nβ€’ Emoji-filled
19
+ error messages\nβ€’ Completely fabricated backtraces\n"
20
+ email:
21
+ - Wgpooi@outlook.com
22
+ executables: []
23
+ extensions: []
24
+ extra_rdoc_files: []
25
+ files:
26
+ - LICENSE.txt
27
+ - README.md
28
+ - lib/what_error.rb
29
+ licenses:
30
+ - MIT
31
+ metadata:
32
+ allowed_push_host: https://rubygems.org
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.0
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubygems_version: 3.6.2
48
+ specification_version: 4
49
+ summary: Random errors with nonsensical messages.
50
+ test_files: []